You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/12/13 04:48:16 UTC

[doris] branch master updated: [feature](nereids) Support orderby and groupby int literal as ordinal of the select list expr (#14862)

This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 414566b56d [feature](nereids) Support orderby and groupby int literal as ordinal of the select list expr (#14862)
414566b56d is described below

commit 414566b56dabbbe25e5fa3fbc096d739348009d0
Author: Kikyou1997 <33...@users.noreply.github.com>
AuthorDate: Tue Dec 13 12:48:09 2022 +0800

    [feature](nereids) Support orderby and groupby int literal as ordinal of the select list expr (#14862)
---
 .../doris/nereids/jobs/batch/AnalyzeRulesJob.java  |  2 +
 .../jobs/batch/NereidsRewriteJobExecutor.java      |  2 +
 .../org/apache/doris/nereids/rules/RuleType.java   |  3 +
 .../ResolveOrdinalInOrderByAndGroupBy.java         | 96 ++++++++++++++++++++++
 .../expression/rewrite/rules/FoldConstantRule.java |  7 ++
 .../rewrite/logical/EliminateGroupByConstant.java  |  2 +
 .../rewrite/logical/EliminateOrderByConstant.java  | 48 +++++++++++
 .../nereids/trees/plans/logical/LogicalSort.java   |  5 ++
 .../doris/statistics/AnalysisTaskExecutorTest.java | 16 +++-
 .../data/nereids_syntax_p0/group_by_constant.out   | 21 +++++
 .../data/nereids_syntax_p0/order_by_const.out      | 16 ++++
 .../nereids_syntax_p0/group_by_constant.groovy     |  9 ++
 ...up_by_constant.groovy => order_by_const.groovy} | 21 ++---
 13 files changed, 233 insertions(+), 15 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/AnalyzeRulesJob.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/AnalyzeRulesJob.java
index a366de9794..6f61e7bc0f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/AnalyzeRulesJob.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/AnalyzeRulesJob.java
@@ -27,6 +27,7 @@ import org.apache.doris.nereids.rules.analysis.NormalizeRepeat;
 import org.apache.doris.nereids.rules.analysis.ProjectToGlobalAggregate;
 import org.apache.doris.nereids.rules.analysis.RegisterCTE;
 import org.apache.doris.nereids.rules.analysis.ReplaceExpressionByChildOutput;
+import org.apache.doris.nereids.rules.analysis.ResolveOrdinalInOrderByAndGroupBy;
 import org.apache.doris.nereids.rules.analysis.Scope;
 import org.apache.doris.nereids.rules.analysis.UserAuthentication;
 
@@ -57,6 +58,7 @@ public class AnalyzeRulesJob extends BatchRulesJob {
                     new BindSlotReference(scope),
                     new BindFunction(),
                     new ProjectToGlobalAggregate(),
+                    new ResolveOrdinalInOrderByAndGroupBy(),
                     new ReplaceExpressionByChildOutput()
                 )),
                 topDownBatch(ImmutableList.of(
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/NereidsRewriteJobExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/NereidsRewriteJobExecutor.java
index a64b9385ed..6162c609b3 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/NereidsRewriteJobExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/NereidsRewriteJobExecutor.java
@@ -30,6 +30,7 @@ import org.apache.doris.nereids.rules.rewrite.logical.ColumnPruning;
 import org.apache.doris.nereids.rules.rewrite.logical.EliminateFilter;
 import org.apache.doris.nereids.rules.rewrite.logical.EliminateGroupByConstant;
 import org.apache.doris.nereids.rules.rewrite.logical.EliminateLimit;
+import org.apache.doris.nereids.rules.rewrite.logical.EliminateOrderByConstant;
 import org.apache.doris.nereids.rules.rewrite.logical.EliminateUnnecessaryProject;
 import org.apache.doris.nereids.rules.rewrite.logical.ExtractSingleTableExpressionFromDisjunction;
 import org.apache.doris.nereids.rules.rewrite.logical.FindHashConditionForJoin;
@@ -94,6 +95,7 @@ public class NereidsRewriteJobExecutor extends BatchRulesJob {
                 // we need to execute this rule at the end of rewrite
                 // to avoid two consecutive same project appear when we do optimization.
                 .add(topDownBatch(ImmutableList.of(new EliminateGroupByConstant())))
+                .add(topDownBatch(ImmutableList.of(new EliminateOrderByConstant())))
                 .add(topDownBatch(ImmutableList.of(new EliminateUnnecessaryProject())))
                 .add(topDownBatch(ImmutableList.of(new PushAggregateToOlapScan())))
                 // this rule batch must keep at the end of rewrite to do some plan check
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleType.java
index 1ff5b82964..b336d7a0a7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleType.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleType.java
@@ -73,6 +73,8 @@ public enum RuleType {
     CHECK_ROW_POLICY(RuleTypeClass.REWRITE),
 
     ELIMINATE_EXCEPT(RuleTypeClass.REWRITE),
+    RESOLVE_ORDINAL_IN_ORDER_BY(RuleTypeClass.REWRITE),
+    RESOLVE_ORDINAL_IN_GROUP_BY(RuleTypeClass.REWRITE),
 
     // check analysis rule
     CHECK_ANALYSIS(RuleTypeClass.CHECK),
@@ -86,6 +88,7 @@ public enum RuleType {
     ELIMINATE_UNNECESSARY_PROJECT(RuleTypeClass.REWRITE),
     LOGICAL_SUB_QUERY_ALIAS_TO_LOGICAL_PROJECT(RuleTypeClass.REWRITE),
     ELIMINATE_GROUP_BY_CONSTANT(RuleTypeClass.REWRITE),
+    ELIMINATE_ORDER_BY_CONSTANT(RuleTypeClass.REWRITE),
 
     // subquery analyze
     ANALYZE_FILTER_SUBQUERY(RuleTypeClass.REWRITE),
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/ResolveOrdinalInOrderByAndGroupBy.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/ResolveOrdinalInOrderByAndGroupBy.java
new file mode 100644
index 0000000000..1af4ccf10b
--- /dev/null
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/ResolveOrdinalInOrderByAndGroupBy.java
@@ -0,0 +1,96 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.rules.analysis;
+
+import org.apache.doris.nereids.properties.OrderKey;
+import org.apache.doris.nereids.rules.Rule;
+import org.apache.doris.nereids.rules.RuleType;
+import org.apache.doris.nereids.rules.expression.rewrite.rules.FoldConstantRule;
+import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.trees.expressions.NamedExpression;
+import org.apache.doris.nereids.trees.expressions.Slot;
+import org.apache.doris.nereids.trees.expressions.literal.IntegerLikeLiteral;
+import org.apache.doris.nereids.trees.expressions.literal.Literal;
+import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.commons.collections.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * SELECT col1, col2 FROM t1 ORDER BY 1 -> SELECT col1, col2 FROM t1 ORDER BY col1
+ * SELECT col1, SUM(col2) FROM t1 GROUP BY 1 -> SELECT col1, SUM(col2) FROM t1 GROUP BY col1
+ */
+public class ResolveOrdinalInOrderByAndGroupBy implements AnalysisRuleFactory {
+
+    @Override
+    public List<Rule> buildRules() {
+        return ImmutableList.<Rule>builder()
+                .add(RuleType.RESOLVE_ORDINAL_IN_ORDER_BY.build(
+                        logicalSort().then(sort -> {
+                            List<Slot> childOutput = sort.child().getOutput();
+                            List<OrderKey> orderKeys = sort.getOrderKeys();
+                            List<OrderKey> orderKeysWithoutOrd = new ArrayList<>();
+                            for (OrderKey k : orderKeys) {
+                                Expression expression = k.getExpr();
+                                expression = FoldConstantRule.INSTANCE.rewrite(expression);
+                                if (expression instanceof IntegerLikeLiteral) {
+                                    IntegerLikeLiteral i = (IntegerLikeLiteral) expression;
+                                    int ord = i.getIntValue();
+                                    checkOrd(ord, childOutput.size());
+                                    orderKeysWithoutOrd
+                                            .add(new OrderKey(childOutput.get(ord - 1), k.isAsc(), k.isNullFirst()));
+                                } else {
+                                    orderKeysWithoutOrd.add(k);
+                                }
+                            }
+                            return sort.withOrderByKey(orderKeysWithoutOrd);
+                        })
+                ))
+                .add(RuleType.RESOLVE_ORDINAL_IN_GROUP_BY.build(
+                        logicalAggregate().then(agg -> {
+                            List<NamedExpression> aggOutput = agg.getOutputExpressions();
+                            List<Expression> groupByWithoutOrd = new ArrayList<>();
+                            for (Expression groupByExpr : agg.getGroupByExpressions()) {
+                                groupByExpr = FoldConstantRule.INSTANCE.rewrite(groupByExpr);
+                                if (groupByExpr instanceof IntegerLikeLiteral) {
+                                    IntegerLikeLiteral i = (IntegerLikeLiteral) groupByExpr;
+                                    int ord = i.getIntValue();
+                                    Expression aggExpr = aggOutput.get(ord - 1);
+                                    if (!CollectionUtils.isEmpty(aggExpr.children())
+                                            && aggExpr.child(0) instanceof Literal) {
+                                        continue;
+                                    }
+                                    checkOrd(ord, aggOutput.size());
+                                    groupByWithoutOrd.add(aggExpr);
+                                } else {
+                                    groupByWithoutOrd.add(groupByExpr);
+                                }
+                            }
+                            return new LogicalAggregate(groupByWithoutOrd, agg.getOutputExpressions(), agg.child());
+                        }))).build();
+    }
+
+    private void checkOrd(int ord, int childOutputSize) {
+        if (ord < 1 || ord > childOutputSize) {
+            throw new IllegalStateException(String.format("ordinal exceeds number of items in select list: %s", ord));
+        }
+    }
+}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rewrite/rules/FoldConstantRule.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rewrite/rules/FoldConstantRule.java
index 175e40b0aa..fcd8a7cff2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rewrite/rules/FoldConstantRule.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rewrite/rules/FoldConstantRule.java
@@ -20,6 +20,7 @@ package org.apache.doris.nereids.rules.expression.rewrite.rules;
 import org.apache.doris.nereids.rules.expression.rewrite.AbstractExpressionRewriteRule;
 import org.apache.doris.nereids.rules.expression.rewrite.ExpressionRewriteContext;
 import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.qe.ConnectContext;
 
 /**
  * Constant evaluation of an expression.
@@ -35,5 +36,11 @@ public class FoldConstantRule extends AbstractExpressionRewriteRule {
         }
         return FoldConstantRuleOnFE.INSTANCE.rewrite(expr, ctx);
     }
+
+    public Expression rewrite(Expression expr) {
+        ExpressionRewriteContext ctx = new ExpressionRewriteContext(ConnectContext.get());
+        return rewrite(expr, ctx);
+    }
+
 }
 
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateGroupByConstant.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateGroupByConstant.java
index 31bd0f7a00..9ea4bc8849 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateGroupByConstant.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateGroupByConstant.java
@@ -19,6 +19,7 @@ package org.apache.doris.nereids.rules.rewrite.logical;
 
 import org.apache.doris.nereids.rules.Rule;
 import org.apache.doris.nereids.rules.RuleType;
+import org.apache.doris.nereids.rules.expression.rewrite.rules.FoldConstantRule;
 import org.apache.doris.nereids.rules.rewrite.OneRewriteRuleFactory;
 import org.apache.doris.nereids.trees.expressions.Expression;
 import org.apache.doris.nereids.trees.expressions.NamedExpression;
@@ -50,6 +51,7 @@ public class EliminateGroupByConstant extends OneRewriteRuleFactory {
             List<NamedExpression> outputExprs = aggregate.getOutputExpressions();
             Set<Expression> slotGroupByExprs = Sets.newLinkedHashSet();
             for (Expression expression : groupByExprs) {
+                expression = FoldConstantRule.INSTANCE.rewrite(expression);
                 if (!(expression instanceof Literal)) {
                     slotGroupByExprs.add(expression);
                 }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateOrderByConstant.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateOrderByConstant.java
new file mode 100644
index 0000000000..ed4b7c6d31
--- /dev/null
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateOrderByConstant.java
@@ -0,0 +1,48 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.rules.rewrite.logical;
+
+import org.apache.doris.nereids.properties.OrderKey;
+import org.apache.doris.nereids.rules.Rule;
+import org.apache.doris.nereids.rules.RuleType;
+import org.apache.doris.nereids.rules.rewrite.OneRewriteRuleFactory;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * SELECT * FROM lineorder ORDER BY 'f' -> SELECT * FROM lineorder
+ */
+public class EliminateOrderByConstant extends OneRewriteRuleFactory {
+
+    @Override
+    public Rule build() {
+        return logicalSort().then(sort -> {
+            List<OrderKey> orderKeysWithoutConst = sort
+                    .getOrderKeys()
+                    .stream()
+                    .filter(k -> !(k.getExpr().isConstant()))
+                    .collect(Collectors.toList());
+            if (orderKeysWithoutConst.isEmpty()) {
+                return sort.child();
+            }
+            return sort.withOrderByKey(orderKeysWithoutConst);
+        }).toRule(RuleType.ELIMINATE_ORDER_BY_CONSTANT);
+    }
+
+}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalSort.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalSort.java
index 299b7ed86f..9cabc96efb 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalSort.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalSort.java
@@ -118,4 +118,9 @@ public class LogicalSort<CHILD_TYPE extends Plan> extends LogicalUnary<CHILD_TYP
     public Plan withLogicalProperties(Optional<LogicalProperties> logicalProperties) {
         return new LogicalSort<>(orderKeys, Optional.empty(), logicalProperties, child());
     }
+
+    public Plan withOrderByKey(List<OrderKey> orderKeysWithoutConst) {
+        return new LogicalSort(orderKeysWithoutConst, Optional.empty(),
+                Optional.of(getLogicalProperties()), child());
+    }
 }
diff --git a/fe/fe-core/src/test/java/org/apache/doris/statistics/AnalysisTaskExecutorTest.java b/fe/fe-core/src/test/java/org/apache/doris/statistics/AnalysisTaskExecutorTest.java
index f9fcbaf55f..6d7b3b4e43 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/statistics/AnalysisTaskExecutorTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/statistics/AnalysisTaskExecutorTest.java
@@ -60,14 +60,21 @@ public class AnalysisTaskExecutorTest extends TestWithFeService {
 
     @Test
     public void testExpiredJobCancellation() throws Exception {
-        AnalysisTaskExecutor analysisTaskExecutor = new AnalysisTaskExecutor(analysisTaskScheduler);
-        BlockingQueue<AnalysisTaskWrapper> b = Deencapsulation.getField(analysisTaskExecutor, "jobQueue");
         AnalysisTaskInfo analysisJobInfo = new AnalysisTaskInfoBuilder().setJobId(0).setTaskId(0)
                 .setCatalogName("internal").setDbName("default_cluster:analysis_job_test").setTblName("t1")
                 .setColName("col1").setJobType(JobType.MANUAL).setAnalysisMethod(AnalysisMethod.FULL).setAnalysisType(
                         AnalysisType.COLUMN)
                 .build();
         OlapAnalysisTask analysisJob = new OlapAnalysisTask(analysisTaskScheduler, analysisJobInfo);
+
+        new Expectations() {
+            {
+                analysisTaskScheduler.getPendingTasks();
+                result = analysisJob;
+            }
+        };
+        AnalysisTaskExecutor analysisTaskExecutor = new AnalysisTaskExecutor(analysisTaskScheduler);
+        BlockingQueue<AnalysisTaskWrapper> b = Deencapsulation.getField(analysisTaskExecutor, "jobQueue");
         AnalysisTaskWrapper analysisTaskWrapper = new AnalysisTaskWrapper(analysisTaskExecutor, analysisJob);
         Deencapsulation.setField(analysisTaskWrapper, "startTime", 5);
         b.put(analysisTaskWrapper);
@@ -79,6 +86,11 @@ public class AnalysisTaskExecutorTest extends TestWithFeService {
         };
         analysisTaskExecutor.start();
         BlockingCounter counter = Deencapsulation.getField(analysisTaskExecutor, "blockingCounter");
+        int sleepTime = 500;
+        while (counter.getVal() != 0 && sleepTime > 0) {
+            sleepTime -= 100;
+            Thread.sleep(100);
+        }
         Assertions.assertEquals(0, counter.getVal());
     }
 
diff --git a/regression-test/data/nereids_syntax_p0/group_by_constant.out b/regression-test/data/nereids_syntax_p0/group_by_constant.out
index e5e0a2ded8..287925c450 100644
--- a/regression-test/data/nereids_syntax_p0/group_by_constant.out
+++ b/regression-test/data/nereids_syntax_p0/group_by_constant.out
@@ -2,3 +2,24 @@
 -- !select_1 --
 str	21	1309892	8	1
 str	24	1310179	10	1
+
+-- !sql --
+1303	1432	0
+1303	1165	7
+1312	1455	8
+
+-- !sql --
+1432	1303	0
+1165	1303	7
+1455	1312	8
+
+-- !sql --
+1432	1	0
+1165	1	7
+1455	1	8
+
+-- !sql --
+1432	1	0
+1165	1	7
+1455	1	8
+
diff --git a/regression-test/data/nereids_syntax_p0/order_by_const.out b/regression-test/data/nereids_syntax_p0/order_by_const.out
new file mode 100644
index 0000000000..39000858a2
--- /dev/null
+++ b/regression-test/data/nereids_syntax_p0/order_by_const.out
@@ -0,0 +1,16 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+1303	1165	9
+1303	1432	15
+1312	1455	29
+
+-- !sql --
+1165	1303	9
+1432	1303	15
+1455	1312	29
+
+-- !sql --
+1432	1303	15
+1165	1303	9
+1455	1312	29
+
diff --git a/regression-test/suites/nereids_syntax_p0/group_by_constant.groovy b/regression-test/suites/nereids_syntax_p0/group_by_constant.groovy
index c2bd39e648..e57f58f70e 100644
--- a/regression-test/suites/nereids_syntax_p0/group_by_constant.groovy
+++ b/regression-test/suites/nereids_syntax_p0/group_by_constant.groovy
@@ -29,4 +29,13 @@ suite("group_by_constant") {
     qt_select_1 """ 
         select 'str', sum(lo_tax), lo_orderkey, max(lo_discount), 1 from lineorder, customer group by 3, 5, 'str', 1, lo_orderkey order by lo_orderkey;
     """
+
+    qt_sql """SELECT lo_custkey, lo_partkey, SUM(lo_tax) FROM lineorder GROUP BY 1, 2"""
+
+    qt_sql """SELECT lo_partkey, lo_custkey, SUM(lo_tax) FROM lineorder GROUP BY 1, 2"""
+
+    qt_sql """SELECT lo_partkey, 1, SUM(lo_tax) FROM lineorder GROUP BY 1,  1 + 1"""
+
+    qt_sql """SELECT lo_partkey, 1, SUM(lo_tax) FROM lineorder GROUP BY 'g',  1"""
+
 }
diff --git a/regression-test/suites/nereids_syntax_p0/group_by_constant.groovy b/regression-test/suites/nereids_syntax_p0/order_by_const.groovy
similarity index 67%
copy from regression-test/suites/nereids_syntax_p0/group_by_constant.groovy
copy to regression-test/suites/nereids_syntax_p0/order_by_const.groovy
index c2bd39e648..d2888debef 100644
--- a/regression-test/suites/nereids_syntax_p0/group_by_constant.groovy
+++ b/regression-test/suites/nereids_syntax_p0/order_by_const.groovy
@@ -15,18 +15,13 @@
 // specific language governing permissions and limitations
 // under the License.
 
-suite("group_by_constant") {
-    sql """
-        SET enable_vectorized_engine=true
-    """
-
-    sql """
-        SET enable_nereids_planner=true
-    """
-
+suite("order_by_const") {
+    sql "SET enable_nereids_planner=true"
     sql "SET enable_fallback_to_original_planner=false"
+    sql "SET enable_vectorized_engine=true"
+
 
-    qt_select_1 """ 
-        select 'str', sum(lo_tax), lo_orderkey, max(lo_discount), 1 from lineorder, customer group by 3, 5, 'str', 1, lo_orderkey order by lo_orderkey;
-    """
-}
+    qt_sql """SELECT lo_custkey, lo_partkey, lo_suppkey FROM lineorder ORDER BY 1, 2 LIMIT 3"""
+    qt_sql """SELECT lo_partkey, lo_custkey, lo_suppkey FROM lineorder ORDER BY 1, 2 LIMIT 3"""
+    qt_sql """SELECT lo_partkey, lo_custkey, lo_suppkey FROM lineorder ORDER BY 'g', 1+1 LIMIT 3"""
+}
\ No newline at end of file


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