Add range support for window function#18953
Conversation
89dff64 to
0eb2a26
Compare
c068697 to
49179dc
Compare
b1c489e to
ce2b2a1
Compare
ce2b2a1 to
a0de070
Compare
a0de070 to
98a2662
Compare
feilong-liu
left a comment
There was a problem hiding this comment.
Added comments on the mapping between this PR and the ported PR to help review.
There was a problem hiding this comment.
Change in this file match the change in the ported PR https://github.com/trinodb/trino/pull/5639/files#diff-fbcf95c2a430eb781899577e1a8f949debae117552e3449f6c91acbb02e21efa
There was a problem hiding this comment.
Corresponding to changes here https://github.com/trinodb/trino/pull/5639/files#diff-01bc66a3163352eb4ad49f6100ca0652ca7f53e6a32d9795deed8e9f6f187b02
INVALID_ORDER_BY is added in the ported PR, MISSING_ORDER_BY was added before this ported PR and not available in our codebase, hence add here.
There was a problem hiding this comment.
Not from ported PR.
Need this change, as it's accessed in test TestWindowFrameRange
There was a problem hiding this comment.
There was a problem hiding this comment.
The difference is that, in the ported PR, it's using BlockPositionComparison which compares two block positions in ascending order, which is not available in our codebase. Here use the compareBlockValue function of sort order.
There was a problem hiding this comment.
Not from ported PR. Change as we added additional fields.
There was a problem hiding this comment.
Not in ported PR.
Change this, because the planner will add one more project to cast the sortkey to the same type as the offset expression. While in this test, it only contains a minimum number of rules, which will fail to remove this additional project node.
I've checked queries end to end with the full plan optimizer list, this additional project node will be removed, hence not a problem
There was a problem hiding this comment.
There was a problem hiding this comment.
Not from ported PR.
There was a problem hiding this comment.
There was a problem hiding this comment.
This will run with LocalQueryRunner. I think it would also be worth running with a distributed query runner to be confident the execution side is correct in a distributed environment. Maybe instead add these tests to AbstractTestWindowQueries. That way we'll also get some spill-to-disk tests for free (via TestSpilledWindowQueries, which extends that class), as we want to make sure that spilling also works for this.
ec4bcf2 to
64b06c9
Compare
|
@prestobot kick off tests |
64b06c9 to
8c42b16
Compare
presto-main/src/main/java/com/facebook/presto/sql/planner/QueryPlanner.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/sql/planner/QueryPlanner.java
Outdated
Show resolved
Hide resolved
presto-main/src/test/java/com/facebook/presto/sql/planner/TestWindowFrameRange.java
Outdated
Show resolved
Hide resolved
presto-main/src/test/java/com/facebook/presto/sql/planner/assertions/SymbolAliases.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Is this change related?
There was a problem hiding this comment.
Yes. This is not ported, it's added for this PR.
This is because the tests added include Date type. In our test code, we convert the returned result for both Presto and H2 query runner to the same type for comparison. This code is to handle the case for DateType.
8c42b16 to
2d9481f
Compare
Cherry-pick of trinodb/trino#5639 Co-authored-by: Jinlin Zhang <z_jinlin@yahoo.com> Co-authored-by: kasiafi <30203062+kasiafi@users.noreply.github.com>
2d9481f to
a3c6d08
Compare
supersede #16932
Cherry-pick of trinodb/trino#5639
Co-authored-by: Jinlin Zhang z_jinlin@yahoo.com
Co-authored-by: kasiafi 30203062+kasiafi@users.noreply.github.com
Test plan - (Please fill in how you tested your changes)
Unit tests.