Skip to content

Commit 28c2498

Browse files
committed
fix(snowflake): ensure that empty arrays unnest to nothing
1 parent 5526c40 commit 28c2498

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ibis/backends/snowflake/registry.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,12 @@ def _unnest(t, op):
193193
# HACK: https://community.snowflake.com/s/question/0D50Z000086MVhnSAG/has-anyone-found-a-way-to-unnest-an-array-without-loosing-the-null-values
194194
sep = util.guid()
195195
col = sa.func.nullif(
196-
sa.func.split_to_table(sa.func.array_to_string(arg, sep), sep)
196+
sa.func.split_to_table(
197+
sa.func.array_to_string(
198+
sa.func.nullif(arg, sa.func.array_construct()), sep
199+
),
200+
sep,
201+
)
197202
.table_valued("value") # seq, index, value is supported but we only need value
198203
.lateral()
199204
.c["value"],

0 commit comments

Comments
 (0)