Add support for OFFSET clause#16035
Conversation
5df5fd4 to
a1e60fa
Compare
26f021d to
1201c07
Compare
|
Can we make sure we have a "kill switch" for this feature? A configuration to disable it if things go wrong in production. |
A session-level control switch |
029bd5c to
1d7537b
Compare
|
@rongrong @yingsu00 @tdcmeehan please help review the PR, thanks |
|
This PR needs a release note. Please refer to https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines to add one in the PR description section. The release bot will automatically gather it from all merged PRs. |
|
Let's use the same commit names as the Trino ones so that readers will be easy to reason about the history |
presto-main/src/main/java/com/facebook/presto/sql/analyzer/FeaturesConfig.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/sql/analyzer/FeaturesConfig.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/sql/analyzer/FeaturesConfig.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/sql/analyzer/FeaturesConfig.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
isEnableOffset -> isOffsetClauseEnabled
There was a problem hiding this comment.
@fgwang7w I don't see this function name changed yet.
presto-main/src/main/java/com/facebook/presto/SystemSessionProperties.java
Outdated
Show resolved
Hide resolved
presto-parser/src/main/java/com/facebook/presto/sql/parser/AstBuilder.java
Outdated
Show resolved
Hide resolved
presto-parser/src/test/java/com/facebook/presto/sql/parser/TestSqlParser.java
Outdated
Show resolved
Hide resolved
yingsu00
left a comment
There was a problem hiding this comment.
Where is the unit test TestImplementOffset.java? It should be added in package com.facebook.presto.sql.planner.iterative.rule
presto-parser/src/main/antlr4/com/facebook/presto/sql/parser/SqlBase.g4
Outdated
Show resolved
Hide resolved
presto-parser/src/test/java/com/facebook/presto/sql/parser/TestSqlParser.java
Outdated
Show resolved
Hide resolved
Thank you for reviewing the PR. Please help review the revision. |
|
Commit message 1 I'd prefer changing the message
|
yingsu00
left a comment
There was a problem hiding this comment.
I strongly believe trinodb/trino#746 should belong to the first commit(parser changes) not the second(planner changes). Would you please also update the commit messages so that the first commit contains 723 and 746 and the second commit contains the rest? Remember to use the full URL so that they resolve to the correct commits. Then add another commit for the documentation. Thanks!
presto-parser/src/test/java/com/facebook/presto/sql/parser/TestSqlParser.java
Outdated
Show resolved
Hide resolved
|
@yingsu00 Thanks for suggestions and review. Please help review the revisions again. |
yingsu00
left a comment
There was a problem hiding this comment.
@fgwang7w Hi George, it looks in good shape. Just two small catches:
- The function name
isEnableOffsetin SystemSessionProperties was still not updated - The commit message for the second commit still has 746 included. Please remove 746 from the commit message.
There was a problem hiding this comment.
@fgwang7w I don't see this function name changed yet.
|
@rongrong I think this PR is almost good to go (waiting for two small issues being fixed). Do you want to take a second pass? Thanks! |
|
@fgwang7w Just discussed with Rongrong. Will you be able to set the session and config properties default to false, and move the 3rd commit to the first? |
0d0b2f5 to
6ed0ef0
Compare
Cherry-pick of trinodb/trino#723 and trinodb/trino#746 Co-authored-by: kasiafi <30203062+kasiafi@users.noreply.github.com>
Cherry-pick of trinodb/trino#732, trinodb/trino#820 Co-authored-by: kasiafi <30203062+kasiafi@users.noreply.github.com>
Cherry-pick of trinodb/trino#750 and trinodb/trino#856 Co-authored-by: kasiafi <30203062+kasiafi@users.noreply.github.com>
|
@rongrong looks like all the comments are addressed. Can you take a look and merge it . |
|
Thanks for your contribution! |
This PR adds support for the result offset clause in SQL query expressions.
The OFFSET node is implemented by transforming it to RowNumber and Filter or FilterProject nodes. An example query plan is as follows:

Resolves #14837
Cherry-pick of trinodb/trino#723, trinodb/trino#732, trinodb/trino#746, trinodb/trino#820
Co-authored-by: kasiafi 30203062+kasiafi@users.noreply.github.com
Test plan - Add UT coverage, and test the feature locally