Repository navigation
fix(compliance): read window NULL placement in the grader as the authored dialect means it - #756
Merged
jbonofre merged 1 commit intoNov 18, 2026
Conversation
This was referenced Nov 18, 2026
jbonofre
self-requested a review
November 18, 2026 21:42
…ored dialect means it sqlglot's base dialect sorts NULL as the smallest value, the opposite of the OSSIE_SQL_2026 default (apache#587). The grader therefore marked RANK() OVER (ORDER BY x DESC NULLS LAST), which changes the order, as a cosmetic rewrite of RANK() OVER (ORDER BY x DESC), and the equivalent DESC NULLS FIRST as needing review. OSSIE_SQL_2026 expressions are now compared with NULL as the largest value; ANSI_SQL ones, whose default is the engine's, only count as cosmetic when equal under both orderings. Co-authored-by: Isaac <no-reply@databricks.com>
jbonofre
force-pushed
the
fix/grader-window-null-ordering
branch
from
November 18, 2026 21:48
a54e83e to
31914e3
Compare
jbonofre
approved these changes
Nov 18, 2026
jbonofre
left a comment
Member
There was a problem hiding this comment.
LGTM, thanks for splitting this out and adding the tests.
Using NULL_ORDERING = "nulls_are_large" for OSSIE_SQL_2026 alignes the grader with core-spec/expression_language.md (#587), so explicit default placements (DESC NULLS FIRST, ASC NULLS LAST) are treated as cosmetic while flipped ones are flagged for review.
Also, comparing ANSI_SQL under both nulls_are_small and nulls_are_large cleanly avoids false cosmetic matches between omitted and explicit placements while keeping genuine spelling rewrites (such as column qualification) cosmetic.
I rebased from main after #757.
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.
Summary
The grader read an omitted NULL placement in a window
ORDER BYthe opposite way from the spec. Split out of #700 so the fix can be reviewed on its own; the M7 and M8 fixtures stay in #700.It normalizes expressions with sqlglot's base dialect, which sorts NULL as the smallest value. So for
RANK() OVER (ORDER BY amount DESC)it graded a converter returning... DESC NULLS LAST, which moves the NULL rows from first to last, as a cosmetic rewrite, and the equivalent... DESC NULLS FIRSTas needing review. It is the same reading #587 describes for the SQLGlot-based converters. The grader now picks the NULL ordering from the authored tag:OSSIE_SQL_2026: NULL is the largest value, as feat(core-spec): default NULL placement in window ORDER BY #587 defines.ANSI_SQL: the default is the engine's, so an omitted and an explicit placement count as cosmetic only when they agree under both orderings.Nothing else changes in how expressions are compared.
Validation
OSSIE_SQL_2026, and that inANSI_SQLneither explicit placement is proven equal to an omitted one. They fail without the fix.Related Issues
Refs apache/ossie-converters#24. Uses the default from #587. Companion to #700 (M7 and M8); the two do not conflict.