Skip to content

Commit

Permalink
fix(polars): use double explode -> implode hack to flatten
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Sep 19, 2024
1 parent 9c7b1f5 commit addc6b6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ibis/backends/polars/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,11 @@ def array_flatten(op, **kw):
.then(None)
.when(result.list.len() == 0)
.then([])
.otherwise(result.flatten())
# polars doesn't have a sane API (yet?) for removing one level of
# nesting from an array so we use this hack
#
# https://github.com/ibis-project/ibis/issues/10135
.otherwise(result.explode().explode().implode())
)


Expand Down

0 comments on commit addc6b6

Please sign in to comment.