Skip to content

Commit

Permalink
fix(snowflake): handle udf function naming
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Feb 12, 2024
1 parent 0b9a40c commit 926eda6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ibis/backends/snowflake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ def _get_udf_source(self, udf_node: ops.ScalarUDF):
return dict(
source=source,
name=name,
func_name=udf_node.__func_name__,
preamble="\n".join(preamble_lines).format(
name=name,
signature=signature,
Expand Down Expand Up @@ -351,7 +352,7 @@ def _compile_pyarrow_udf(self, udf_node: ops.ScalarUDF) -> None:
def _compile_python_udf(self, udf_node: ops.ScalarUDF) -> str:
return """\
{preamble}
HANDLER = '{name}'
HANDLER = '{func_name}'
AS $$
from __future__ import annotations
Expand All @@ -376,7 +377,7 @@ def _compile_pandas_udf(self, udf_node: ops.ScalarUDF) -> str:
@_snowflake.vectorized(input=pd.DataFrame)
def wrapper(df):
return {name}(*(col for _, col in df.items()))
return {func_name}(*(col for _, col in df.items()))
$$"""
return template.format(**self._get_udf_source(udf_node))

Expand Down

0 comments on commit 926eda6

Please sign in to comment.