From b45ea319c065c55ca9bc8bf757f4bc5ee0a8cbfa Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 19 Jan 2024 04:50:27 -0500 Subject: [PATCH] fix(snowflake): handle udf function naming --- ibis/backends/snowflake/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ibis/backends/snowflake/__init__.py b/ibis/backends/snowflake/__init__.py index 6096e2f753130..6edf9aa75d8d6 100644 --- a/ibis/backends/snowflake/__init__.py +++ b/ibis/backends/snowflake/__init__.py @@ -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, @@ -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 @@ -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))