Skip to content

fix: Respect NULLS FIRST/LAST in a window's ORDER BY - #29159

Merged
ritchie46 merged 1 commit into
mainfrom
sql-window-nulls-order
Sep 4, 2026
Merged

ritchie46 merged 1 commit into
mainfrom
sql-window-nulls-order

Conversation

@ritchie46

@ritchie46 ritchie46 commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

fixes: #29151

🤖 Generated with Claude Code

`parse_order_by_in_window` only returned the sort direction, so the null
placement given in an `OVER (ORDER BY ...)` clause was dropped. It now
returns full `SortOptions` and rejects mixed NULLS FIRST/LAST ordering the
same way mixed asc/desc is rejected.

The per-key defaulting rule (nulls last for ASC, nulls first for DESC) was
spelled out inline at four sites across `context.rs` and `functions.rs`;
it now lives in one `order_by_sort_options` helper that they all call.

Fixes #29151

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jg2Z9Ao8UhwqJ5R1UkSosy
@ritchie46 ritchie46 changed the title fix(sql): Respect NULLS FIRST/LAST in a window's ORDER BY fix: Respect NULLS FIRST/LAST in a window's ORDER BY Sep 4, 2026
@github-actions github-actions Bot added A-sql Area: Polars SQL functionality fix Bug fix title needs formatting labels Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

The uncompressed lib size after this PR is 54.7291 MB (at b620077).

@github-actions github-actions Bot added python Related to Python Polars rust Related to Rust Polars labels Sep 4, 2026
@ritchie46
ritchie46 merged commit e793439 into main Sep 4, 2026
37 of 38 checks passed
@ritchie46
ritchie46 deleted the sql-window-nulls-order branch September 4, 2026 15:46
@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.96970% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.68%. Comparing base (fec681c) to head (b620077).
⚠️ Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
crates/polars-sql/src/functions.rs 95.23% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #29159      +/-   ##
==========================================
+ Coverage   81.65%   81.68%   +0.02%     
==========================================
  Files        1905     1905              
  Lines      270933   270967      +34     
  Branches     3105     3105              
==========================================
+ Hits       221242   221344     +102     
+ Misses      48906    48840      -66     
+ Partials      785      783       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-sql Area: Polars SQL functionality fix Bug fix python Related to Python Polars rust Related to Rust Polars title needs formatting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQL: NULLS FIRST/NULLS LAST ignored inside a window's ORDER BY

1 participant