Skip to content

Commit

Permalink
refactor(snowflake): use upstream map-from-arrays function instead of…
Browse files Browse the repository at this point in the history
… a custom UDF
  • Loading branch information
cpcloud authored and gforsyth committed Dec 13, 2023
1 parent 42b6845 commit 318459c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions ibis/backends/snowflake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ class SnowflakeCompiler(AlchemyCompiler):
"returns": ARRAY,
"source": "return Object.values(obj)",
},
"ibis_udfs.public.object_from_arrays": {
"inputs": {"ks": ARRAY, "vs": ARRAY},
"returns": OBJECT,
"source": "return Object.assign(...ks.map((k, i) => ({[k]: vs[i]})))",
},
"ibis_udfs.public.array_zip": {
"inputs": {"arrays": ARRAY},
"returns": ARRAY,
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/snowflake/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def _timestamp_bucket(t, op):
ops.Map: fixed_arity(
lambda keys, values: sa.func.iff(
sa.func.is_array(keys) & sa.func.is_array(values),
sa.func.ibis_udfs.public.object_from_arrays(keys, values),
sa.func.arrays_to_object(keys, values),
sa.null(),
),
2,
Expand Down

0 comments on commit 318459c

Please sign in to comment.