You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2023/01/20 04:37:59 UTC

[GitHub] [doris] Kikyou1997 opened a new pull request, #16114: [ehancement](nereids) Enhancement for limit clause.

Kikyou1997 opened a new pull request, #16114:
URL: https://github.com/apache/doris/pull/16114

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   Support such Doris SQL dialects.
   
   ```sql
   explain select * from (select * from test order by k1, k2, k3, k4 limit 1, 2) a limit 1, 1;
   ```
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [ ] Yes
       - [ ] No
       - [ ] I don't know
   2. Has unit tests been added:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   3. Has document been added or modified:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   4. Does it need to update dependencies:
       - [ ] Yes
       - [ ] No
   5. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [ ] No
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morrySnow commented on a diff in pull request #16114: [ehancement](nereids) Enhancement for limit clause.

Posted by GitBox <gi...@apache.org>.
morrySnow commented on code in PR #16114:
URL: https://github.com/apache/doris/pull/16114#discussion_r1082166380


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/MergeLimits.java:
##########
@@ -43,11 +42,11 @@
 public class MergeLimits extends OneRewriteRuleFactory {
     @Override
     public Rule build() {
-        return logicalLimit(logicalLimit()).whenNot(Limit::hasValidOffset).then(upperLimit -> {
+        return logicalLimit(logicalLimit()).then(upperLimit -> {
             LogicalLimit<? extends Plan> bottomLimit = upperLimit.child();
             return new LogicalLimit<>(
                     Math.min(upperLimit.getLimit(), bottomLimit.getLimit()),
-                    bottomLimit.getOffset(),
+                    bottomLimit.getOffset() + upperLimit.getOffset(),
                     bottomLimit.child()

Review Comment:
   only sum offset is not right
   consider this scene:
   before merge:
   limit(limit = 7, offset = 5)
   +-- limit(limit = 10, offset = 5)
   
   after bottom limit, we get tuple from 6 to 15
   after top limit, we get tuple from 11 to 15
   
   so, after merge, we should get:
   limit(limit = 5, offset = 10)



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #16114: [ehancement](nereids) Enhancement for limit clause.

Posted by github-actions.
github-actions[bot] commented on PR #16114:
URL: https://github.com/apache/doris/pull/16114#issuecomment-1407267880

   PR approved by anyone and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morrySnow merged pull request #16114: [ehancement](nereids) Enhancement for limit clause.

Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow merged PR #16114:
URL: https://github.com/apache/doris/pull/16114


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] hello-stephen commented on pull request #16114: [ehancement](nereids) Enhancement for limit clause.

Posted by GitBox <gi...@apache.org>.
hello-stephen commented on PR #16114:
URL: https://github.com/apache/doris/pull/16114#issuecomment-1397923648

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 33.84 seconds
    load time: 484 seconds
    storage size: 17122483119 Bytes
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20230120045920_clickbench_pr_84472.html


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #16114: [ehancement](nereids) Enhancement for limit clause.

Posted by github-actions.
github-actions[bot] commented on PR #16114:
URL: https://github.com/apache/doris/pull/16114#issuecomment-1407267873

   PR approved by at least one committer and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] Kikyou1997 commented on a diff in pull request #16114: [ehancement](nereids) Enhancement for limit clause.

Posted by GitBox <gi...@apache.org>.
Kikyou1997 commented on code in PR #16114:
URL: https://github.com/apache/doris/pull/16114#discussion_r1082178305


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/MergeLimits.java:
##########
@@ -43,11 +42,11 @@
 public class MergeLimits extends OneRewriteRuleFactory {
     @Override
     public Rule build() {
-        return logicalLimit(logicalLimit()).whenNot(Limit::hasValidOffset).then(upperLimit -> {
+        return logicalLimit(logicalLimit()).then(upperLimit -> {
             LogicalLimit<? extends Plan> bottomLimit = upperLimit.child();
             return new LogicalLimit<>(
                     Math.min(upperLimit.getLimit(), bottomLimit.getLimit()),
-                    bottomLimit.getOffset(),
+                    bottomLimit.getOffset() + upperLimit.getOffset(),
                     bottomLimit.child()

Review Comment:
   Thanks for your kind reminder



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org