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 d91c3b2 commit eb5f674
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 an efficient API (yet?) for removing one level of
# nesting from an array so we use elementwise evaluation
#
# https://github.com/ibis-project/ibis/issues/10135
.otherwise(result.list.eval(pl.element().flatten()))
)


Expand Down

0 comments on commit eb5f674

Please sign in to comment.