Skip to content

[Minor]: support window functions in order by expressions#20963

Open
buraksenn wants to merge 1 commit intoapache:mainfrom
buraksenn:support-window-functions-in-order-by
Open

[Minor]: support window functions in order by expressions#20963
buraksenn wants to merge 1 commit intoapache:mainfrom
buraksenn:support-window-functions-in-order-by

Conversation

@buraksenn
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

#608 has details but as @alamb describes in #608 (comment)

SELECT c2
  FROM test
  ORDER BY max(c3) OVER (ORDER BY c9);

fails with:

This feature is not implemented: Physical plan does not support logical expression WindowFunction(WindowFunction { fun: AggregateUDF(AggregateUDF { inner: Max { signature: Signature { type_signature: UserDefined, volatility: Immutable, parameter_names: None } } }), params: WindowFunctionParams { args: [Column(Column { relation: Some(Bare { table: "test" }), name: "c3" })], partition_by: [], order_by: [Sort { expr: Column(Column { relation: Some(Bare { table: "test" }), name: "c9" }), asc: true, nulls_first: false }], window_frame: WindowFrame { units: Range, start_bound: Preceding(Int32(NULL)), end_bound: CurrentRow, is_causal: false }, filter: None, null_treatment: None, distinct: false } })

What changes are included in this PR?

  • relevant change
  • slt and unit tests

Are these changes tested?

Yes added both unit tests for plan and slt tests for checking output

Are there any user-facing changes?

Additive user changes that users can now use window in order by expressions

@github-actions github-actions bot added sql SQL Planner sqllogictest SQL Logic Tests (.slt) labels Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sql SQL Planner sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for window functions in order by expression

1 participant