Repository navigation
[Data] Make Polars sort place nulls last - #66925
Merged
owenowenisme merged 3 commits intoOct 13, 2026
Merged
Conversation
Signed-off-by: viiccwen <[email protected]>
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates Polars sorting operations in Ray Data to ensure null values are sorted last by passing nulls_last=True to Polars' sort function, and adds corresponding unit tests. The reviewer pointed out that the nulls_last parameter was introduced in Polars version 0.16.4 and using it with older versions will raise a TypeError. They suggested dynamically constructing the sorting keyword arguments based on the installed Polars version to maintain backward compatibility.
viiccwen
added a commit
to viiccwen/ray
that referenced
this pull request
Oct 12, 2026
Propagate DataContext to the final merge task, preserve non-positive Limit plans, and defer the Polars rewrite until null ordering is aligned by ray-project#66925. Add regression coverage for these cases. Signed-off-by: viiccwen <[email protected]>
owenowenisme
left a comment
Member
There was a problem hiding this comment.
LGTM, but I would make df sort a helper function and add a few comments describing behavior.
Signed-off-by: viiccwen <[email protected]>
Contributor
Author
|
Hello @owenowenisme, thanks for reviewing. I already updated, PTAL. |
owenowenisme
enabled auto-merge (squash)
October 13, 2026 08:55
viiccwen
added a commit
to viiccwen/ray
that referenced
this pull request
Oct 13, 2026
Propagate DataContext to the final merge task, preserve non-positive Limit plans, and defer the Polars rewrite until null ordering is aligned by ray-project#66925. Add regression coverage for these cases. Signed-off-by: viiccwen <[email protected]>
viiccwen
added a commit
to viiccwen/ray
that referenced
this pull request
Oct 28, 2026
Propagate DataContext to the final merge task, preserve non-positive Limit plans, and defer the Polars rewrite until null ordering is aligned by ray-project#66925. Add regression coverage for these cases. Signed-off-by: viiccwen <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Ray Data's Arrow and Pandas sorting paths place null values after non-null values. The Polars implementation used its backend default instead, so enabling
DataContext.use_polars_sortchanged the result order and could change the rows selected bysort(...).limit(k).Pass
nulls_last=Trueto the Polars local-sort and concatenated merge-sort paths. Then, add regressions for Arrow and Polars in ascending and descending order, covering local sorting, cross-block merging, and a four-input/four-outputpartition Dataset sort.
Related issues
Closes #66841
Additional information