morrySnow commented on code in PR #39316:
URL: https://github.com/apache/doris/pull/39316#discussion_r1715188557


##########
regression-test/suites/nereids_syntax_p0/test_limit.groovy:
##########
@@ -19,7 +19,11 @@ suite("test_limit") {
     sql 'set enable_nereids_planner=true'
     sql 'set enable_fallback_to_original_planner=false'
 
-    
+    def DBname = "limit_test_db" 
+    sql "DROP DATABASE IF EXISTS ${DBname}"
+    sql "CREATE DATABASE IF NOT EXISTS ${DBname}"
+    sql "use ${DBname}"

Review Comment:
   why create a db?



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java:
##########
@@ -1827,9 +1827,15 @@ public PlanFragment visitPhysicalNestedLoopJoin(
 
     @Override
     public PlanFragment visitPhysicalLimit(PhysicalLimit<? extends Plan> 
physicalLimit, PlanTranslatorContext context) {
+        Plan childPlan = physicalLimit.child(0);
         PlanFragment inputFragment = physicalLimit.child(0).accept(this, 
context);
         PlanNode child = inputFragment.getPlanRoot();
-        child.setLimit(MergeLimits.mergeLimit(physicalLimit.getLimit(), 
physicalLimit.getOffset(), child.getLimit()));
+        if (childPlan instanceof PhysicalLimit) {

Review Comment:
   the better way fix this problem
   1. remove post process rule: 
org.apache.doris.nereids.processor.post.AddOffsetIntoDistribute
   2. translate global limit into exchange, if its child is not a exchange 
node. refer to 
org.apache.doris.nereids.glue.translator.PhysicalPlanTranslator#visitPhysicalTopN



-- 
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-unsubscr...@doris.apache.org

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


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

Reply via email to