This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
commit 48ed4421b4103061e0bb648f4e083c1d633cbaf3 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 7fe993ae9a..acae7147aa 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 @@ -1162,6 +1162,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