diff --git a/ibis/backends/snowflake/__init__.py b/ibis/backends/snowflake/__init__.py index a9bab59fb878..f1b97eea0adb 100644 --- a/ibis/backends/snowflake/__init__.py +++ b/ibis/backends/snowflake/__init__.py @@ -49,7 +49,7 @@ message="You have an incompatible version of 'pyarrow' installed", category=UserWarning, ) - from snowflake.sqlalchemy import ARRAY, DOUBLE, OBJECT, URL + from snowflake.sqlalchemy import ARRAY, DOUBLE, OBJECT, URL, VARCHAR from ibis.backends.snowflake.converter import SnowflakePandasData from ibis.backends.snowflake.datatypes import SnowflakeType @@ -113,6 +113,11 @@ class SnowflakeCompiler(AlchemyCompiler): "returns": ARRAY, "source": """return Array(count).fill(value).flat();""", }, + "ibis_udfs.public.regexp_split": { + "inputs": {"value": VARCHAR, "pattern": VARCHAR}, + "returns": ARRAY, + "source": """return value.split(new RegExp(pattern, "g"));""", + }, } diff --git a/ibis/backends/snowflake/registry.py b/ibis/backends/snowflake/registry.py index e31466ad64c1..3b8b2926c7b1 100644 --- a/ibis/backends/snowflake/registry.py +++ b/ibis/backends/snowflake/registry.py @@ -564,6 +564,7 @@ def _timestamp_range(t, op): 3, ), ops.TimestampRange: _timestamp_range, + ops.RegexSplit: fixed_arity(sa.func.ibis_udfs.public.regexp_split, 2), } )