Skip to content

fix: Make default sort order nulls last - #1766

Merged
timsaucer merged 2 commits into
apache:mainfrom
nuno-faria:fix_default_sort_null
Oct 6, 2026
Merged

timsaucer merged 2 commits into
apache:mainfrom
nuno-faria:fix_default_sort_null

Conversation

@nuno-faria

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #1765.

Rationale for this change

Make sort follow the same default as upstream (i.e., order nulls last).

What changes are included in this PR?

  • Changed the default value of nulls_first to False.
  • Added a unit test / updated previous tests.

Are there any user-facing changes?

df.sort without an explicit nulls_first orders nulls last, similarly to df.sort_by and SQL's ORDER BY.

@timsaucer

Copy link
Copy Markdown
Member

Thanks! This is changing a public facing API so I think we need an entry in the upgrade guide. It's small, but it's important.

@nuno-faria

Copy link
Copy Markdown
Contributor Author

Thanks! This is changing a public facing API so I think we need an entry in the upgrade guide. It's small, but it's important.

Added. Btw I think the upgrade guide in the website is not being updated, 55.0.0 is currently missing: https://datafusion.apache.org/python/user-guide/upgrade-guides.html

@timsaucer

Copy link
Copy Markdown
Member

Thanks! This is changing a public facing API so I think we need an entry in the upgrade guide. It's small, but it's important.

Added. Btw I think the upgrade guide in the website is not being updated, 55.0.0 is currently missing: https://datafusion.apache.org/python/user-guide/upgrade-guides.html

I think the website only updates when we do the release. You can see them on the staged site which comes off main: https://datafusion.staged.apache.org/python/user-guide/upgrade-guides.html

@timsaucer
timsaucer merged commit 6c5d9ff into apache:main Oct 6, 2026
25 of 26 checks passed
@nuno-faria
nuno-faria deleted the fix_default_sort_null branch October 6, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Null treatment of sort does not follow DataFusion's default

2 participants