Skip to content

docs(core-spec): clarify NULL placement key evaluation and aggregate ORDER BY scope - #676

Draft
jbonofre wants to merge 4 commits into
apache:mainfrom
jbonofre:null-placement-followups
Draft

jbonofre wants to merge 4 commits into
apache:mainfrom
jbonofre:null-placement-followups

Conversation

@jbonofre

@jbonofre jbonofre commented Nov 1, 2026

Copy link
Copy Markdown
Member

Follow-up to #587, which this PR is stacked on. Until #587 merges, the diff also shows its commits; the change here is the last commit only (beb1372).

Two clarifications to the Window ORDER BY NULL Placement section:

  • The CASE sort key repeats order_expr. If the expression is non-deterministic or expensive, implementations SHOULD evaluate it once (subquery or CTE) and order by that result.
  • The section covers window ORDER BY only. PERCENTILE_CONT and PERCENTILE_DISC ignore NULL inputs, so placement does not apply. A future aggregate that orders its inputs and keeps NULLs SHOULD state its NULL placement, and follows this default otherwise.

I will rebase onto main once #587 merges.

ekut and others added 4 commits October 15, 2026 11:21
Without NULLS FIRST or NULLS LAST, NULL sorts as the largest value:
last for ASC, first for DESC. A mapping table lists which engines need
the explicit clause to match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n section

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…be added, OSSIE_SQL_2026 scope and converters

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants