Skip to content

Commit

Permalink
chore: fix polars compiler to not overwrite nulls_first
Browse files Browse the repository at this point in the history
  • Loading branch information
ncclementi committed Jun 20, 2024
1 parent 6f466f8 commit 784213c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ibis/backends/polars/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,14 @@ def sort(op, **kw):

by = list(newcols.keys())
descending = [key.descending for key in op.keys]
# NOT SURE IF THIS IS THE RIGHT THING TO DO
nulls_first = all(key.nulls_first for key in op.keys)
try:
lf = lf.sort(by, descending=descending, nulls_last=True)
lf = lf.sort(by, descending=descending, nulls_last=not nulls_first)
except TypeError: # pragma: no cover
lf = lf.sort(by, reverse=descending, nulls_last=True) # pragma: no cover
lf = lf.sort(
by, reverse=descending, nulls_last=not nulls_first
) # pragma: no cover #THIS DOESN'T WORK reverse doesn't exists (?)

return lf.drop(*by)

Expand Down

0 comments on commit 784213c

Please sign in to comment.