Replies: 3 comments 8 replies
-
We have this issue we could resurrect #77 👍🏻 on supporting an API for this |
Beta Was this translation helpful? Give feedback.
8 replies
-
A piece of implicit context that is worth making explicit here: all of these engines default to ascending sort order. So Ibis doesn't need to do anything new to standardize ascending/descending. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks for the discussion all! I think we'll default to I've created #7252 to track this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently Ibis does not standardize the position of nulls in ordered output. If a user calls
t.order_by(_.x)
ort.order_by(_.x.desc())
and the columnx
has a mix of null and non-null values, then whether the null values appear at the top (first) or the bottom (last) of the results depends entirely on the default behavior of the Ibis backend you are using. Also, Ibis currently does not expose an option to allow users to control whether nulls sort first or last.The behavior of the backend engines is not consistent, but almost all of them do expose an option to control whether nulls sort first or last:
For the backends that do not directly expose the option to control nulls first or nulls last in SQL (mssql, mysql), there is a simple workaround to control this: do
ORDER BY x IS NOT NULL, x
to get nulls first and doORDER BY x IS NULL, x
to get nulls last.Note that this does not consider NaNs in float columns, which are another story and should probably be discussed separately.
Should Ibis standardize null sort order behavior across all the backends?
Beta Was this translation helpful? Give feedback.
All reactions