-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support ORDER BY in window functions #23929
Conversation
Still draft (I think mostly tests are missing). But please take a look. |
74340e7
to
b255927
Compare
931f8a2
to
ea7f65f
Compare
Good for review |
8f5bd36
to
692b296
Compare
...-main/src/main/java/io/trino/sql/planner/iterative/rule/PruneOrderByInWindowAggregation.java
Outdated
Show resolved
Hide resolved
...-main/src/main/java/io/trino/sql/planner/iterative/rule/PruneOrderByInWindowAggregation.java
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/sql/planner/assertions/WindowFunctionProvider.java
Outdated
Show resolved
Hide resolved
692b296
to
d179d49
Compare
addressed |
core/trino-main/src/main/java/io/trino/operator/aggregation/OrderedWindowAccumulator.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/operator/aggregation/OrderedWindowAccumulator.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/operator/aggregation/OrderedWindowAccumulator.java
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/operator/aggregation/OrderedWindowAccumulator.java
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/operator/window/AggregateWindowFunction.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/planner/LocalExecutionPlanner.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/sql/query/TestWindow.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/sql/query/TestWindow.java
Outdated
Show resolved
Hide resolved
d179d49
to
c476873
Compare
core/trino-main/src/main/java/io/trino/operator/aggregation/OrderedWindowAccumulator.java
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/operator/aggregation/OrderedWindowAccumulator.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/operator/aggregation/OrderedWindowAccumulator.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/operator/aggregation/OrderedWindowAccumulator.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/planner/LocalExecutionPlanner.java
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/planner/LocalExecutionPlanner.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/planner/LocalExecutionPlanner.java
Outdated
Show resolved
Hide resolved
7b47bb4
to
82363e0
Compare
dace632
to
835907f
Compare
core/trino-main/src/main/java/io/trino/sql/analyzer/StatementAnalyzer.java
Outdated
Show resolved
Hide resolved
if (windowFunction.getOrderBy().isPresent()) { | ||
throw semanticException(NOT_SUPPORTED, windowFunction, "Window function with ORDER BY is not supported"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not accessible? Is it covered in TestAnalyzer
?
835907f
to
569e9d5
Compare
...n/src/test/java/io/trino/sql/planner/iterative/rule/TestPruneOrderByInWindowAggregation.java
Outdated
Show resolved
Hide resolved
...n/src/test/java/io/trino/sql/planner/iterative/rule/TestPruneOrderByInWindowAggregation.java
Outdated
Show resolved
Hide resolved
addressed. 🍏 @kasiafi ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧌
look on the bright side. This allowed for one more github contribution to collection :P |
569e9d5
to
356835a
Compare
One more thing:
This succeeds by silently ignoring the inner window. In |
For aggregation it does not seem to be handles super well:
|
@kasiafi addressed |
356835a
to
9949d82
Compare
Add basic support for
ORDER BY
in aggregate functions used in WINDOW context.Lightly speaking, not a very performant implementation.
TODO:
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text: