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

yiguolei 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 4cbb6ece10 [fix](fe)ordering exprs should be substituted in the same 
way as select part (#20091)
4cbb6ece10 is described below

commit 4cbb6ece10da55dfb49d29a610ea4e194c9ab40e
Author: starocean999 <40539150+starocean...@users.noreply.github.com>
AuthorDate: Sat May 27 21:00:57 2023 +0800

    [fix](fe)ordering exprs should be substituted in the same way as select 
part (#20091)
---
 fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java    | 4 ++++
 regression-test/data/correctness_p0/test_grouping_with_alias.out      | 3 +++
 regression-test/suites/correctness_p0/test_grouping_with_alias.groovy | 4 +++-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
index 301a24c493..6114d4c00a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
@@ -1366,6 +1366,10 @@ public class SelectStmt extends QueryStmt {
             havingClauseAfterAnaylzed =
                     havingClauseAfterAnaylzed.substitute(countAllMap, 
analyzer, false);
         }
+        if (sortInfo != null) {
+            // the ordering exprs must substitute in the same way as 
resultExprs
+            sortInfo.substituteOrderingExprs(countAllMap, analyzer);
+        }
         aggExprs.clear();
         TreeNode.collect(substitutedAggs, Expr.isAggregatePredicate(), 
aggExprs);
 
diff --git a/regression-test/data/correctness_p0/test_grouping_with_alias.out 
b/regression-test/data/correctness_p0/test_grouping_with_alias.out
index 850b4daf7b..11c59c5041 100644
--- a/regression-test/data/correctness_p0/test_grouping_with_alias.out
+++ b/regression-test/data/correctness_p0/test_grouping_with_alias.out
@@ -7,3 +7,6 @@ all     2
 -- !select2 --
 1.0    1
 
+-- !select3 --
+1.0    1
+
diff --git 
a/regression-test/suites/correctness_p0/test_grouping_with_alias.groovy 
b/regression-test/suites/correctness_p0/test_grouping_with_alias.groovy
index 26f6c5eeab..45232edc45 100644
--- a/regression-test/suites/correctness_p0/test_grouping_with_alias.groovy
+++ b/regression-test/suites/correctness_p0/test_grouping_with_alias.groovy
@@ -54,7 +54,9 @@
     """
     sql """insert into cf_member values(2, 2, '2'); """
 
-    qt_select2 """select floor(id-1.0), count(*) from cf_member cm group by 
floor(id-1.0);"""
+    qt_select2 """select floor(id-1.0), count(*) from cf_member cm group by 
floor(id-1.0) order by floor(id-1.0);"""
+
+    qt_select3 """select floor(id-1.0), count(*) from cf_member cm group by 1 
order by 1;"""
 
     sql """DROP TABLE IF EXISTS `cf_member`; """
  } 
\ No newline at end of file


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

Reply via email to