This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
commit 0b9eb01cef71809581316e83fb22b5d0bf67a023 Author: starocean999 <40539150+starocean...@users.noreply.github.com> AuthorDate: Fri Aug 25 11:21:35 2023 +0800 [fix](planner)literal expr should do nothing in substituteImpl() method (#23438) substitute a literal expr is pointless and wrong. This pr keep literal expr unchanged during substitute process --- .../main/java/org/apache/doris/analysis/LiteralExpr.java | 6 ++++++ .../data/correctness_p0/test_subquery_with_agg.out | 3 +++ .../suites/correctness_p0/test_subquery_with_agg.groovy | 15 +++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/LiteralExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/LiteralExpr.java index bde041aeef..2e2eed316b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/LiteralExpr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/LiteralExpr.java @@ -402,4 +402,10 @@ public abstract class LiteralExpr extends Expr implements Comparable<LiteralExpr public boolean matchExprs(List<Expr> exprs, SelectStmt stmt, boolean ignoreAlias, TupleDescriptor tuple) { return true; } + + @Override + protected Expr substituteImpl(ExprSubstitutionMap smap, ExprSubstitutionMap disjunctsMap, + Analyzer analyzer) { + return this; + } } diff --git a/regression-test/data/correctness_p0/test_subquery_with_agg.out b/regression-test/data/correctness_p0/test_subquery_with_agg.out index 4c443b8493..d055dbd668 100644 --- a/regression-test/data/correctness_p0/test_subquery_with_agg.out +++ b/regression-test/data/correctness_p0/test_subquery_with_agg.out @@ -4,3 +4,6 @@ 2 3 +-- !select2 -- +0 2.0 + diff --git a/regression-test/suites/correctness_p0/test_subquery_with_agg.groovy b/regression-test/suites/correctness_p0/test_subquery_with_agg.groovy index 260cf111cb..e0592830ff 100644 --- a/regression-test/suites/correctness_p0/test_subquery_with_agg.groovy +++ b/regression-test/suites/correctness_p0/test_subquery_with_agg.groovy @@ -63,6 +63,21 @@ suite("test_subquery_with_agg") { subq_1.gid; """ + qt_select2 """ + select + 0 as row_number, + round(sum(num) / 10, 0) as org_id + from + ( + select + num + from + agg_subquery_table + ) t + group by + 1; + """ + sql """ drop table if exists agg_subquery_table; """ --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org