Skip to content

Commit

Permalink
Fix loading of boolean functions
Browse files Browse the repository at this point in the history
  • Loading branch information
amol- committed Apr 18, 2024
1 parent f203d41 commit 1d1cbf8
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/substrait/sql/functions_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def __init__(self):
self._registered_extensions = {}
self._functions = {}
self._functions_return_type = {}
self._register_builtins()

def load_standard_extensions(self, dirpath):
for ext in self.STANDARD_EXTENSIONS:
Expand All @@ -52,7 +51,8 @@ def load(self, dirpath, filename):
function_name = function["name"]
for impl in function.get("impls", []):
# TODO: There seem to be some functions that have arguments without type. What to do?
argtypes = [t.get("value", "unknown") for t in impl.get("args", [])]
# TODO: improve support complext type like LIST?<any>
argtypes = [t.get("value", "unknown").strip("?") for t in impl.get("args", [])]
if not argtypes:
signature = function_name
else:
Expand Down Expand Up @@ -96,17 +96,6 @@ def _register_extensions(
)
self._functions_return_type[function] = functions_return_type[function]

def _register_builtins(self):
self._functions["not:boolean"] = (
proto.SimpleExtensionDeclaration.ExtensionFunction(
name="not",
function_anchor=len(self._functions) + 1,
)
)
self._functions_return_type["not:boolean"] = proto.Type(
bool=proto.Type.Boolean()
)

def _type_from_name(self, typename):
nullable = False
if typename.endswith("?"):
Expand Down

0 comments on commit 1d1cbf8

Please sign in to comment.