viirya opened a new pull request, #25518:
URL: https://github.com/apache/datafusion/pull/25518
## Which issue does this PR close?
- Closes #<issue-number>.
## Rationale for this change
A free `RANGE` window frame determines peers using every `ORDER BY`
expression. However, when the first expression had an offset target type, the
analyzer did not validate the remaining expressions.
Consequently, an unsupported trailing `Map` expression could reach execution
and rows with different map values could incorrectly be treated as peers.
## What changes are included in this PR?
Validate all trailing `ORDER BY` expressions when the first expression
establishes the RANGE target type.
This preserves the existing behavior that accepts a `List` as the first
`ORDER BY` expression, while rejecting unsupported trailing expressions.
A SQL logic regression test for `ORDER BY int_col, map_col` is included.
## What is the testing strategy for this PR?
- Added a regression test in `window.slt`.
- Verified that the old code returns incorrect peer counts while the fixed
code reports a planning error.
- Verified existing first-`List` and supported multi-key cases.
- Ran `cargo fmt --all -- --check`.
- Ran `cargo clippy -p datafusion-optimizer --all-targets --all-features --
-D warnings`.
## Are there any user-facing changes?
Yes. Free `RANGE` frames with an unsupported trailing `ORDER BY` type are now
rejected during planning instead of potentially producing incorrect results.
There are no public API changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]