Skip to content

Commit

Permalink
fix(snowflake): ensure that empty arrays unnest to nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Nov 29, 2023
1 parent 5526c40 commit 28c2498
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ibis/backends/snowflake/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,12 @@ def _unnest(t, op):
# HACK: https://community.snowflake.com/s/question/0D50Z000086MVhnSAG/has-anyone-found-a-way-to-unnest-an-array-without-loosing-the-null-values
sep = util.guid()
col = sa.func.nullif(
sa.func.split_to_table(sa.func.array_to_string(arg, sep), sep)
sa.func.split_to_table(
sa.func.array_to_string(
sa.func.nullif(arg, sa.func.array_construct()), sep
),
sep,
)
.table_valued("value") # seq, index, value is supported but we only need value
.lateral()
.c["value"],
Expand Down

0 comments on commit 28c2498

Please sign in to comment.