From 493c9d49eabf8f0f58f695daaec643c117f6150b Mon Sep 17 00:00:00 2001 From: morrySnow <101034200+morrySnow@users.noreply.github.com> Date: Fri, 1 Mar 2024 16:47:27 +0800 Subject: [PATCH] [fix](Nereids) check slot from children may produce wrong format err (#31638) --- .../nereids/rules/analysis/CheckAfterRewrite.java | 12 +++++++----- .../suites/nereids_p0/aggregate/aggregate.groovy | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/CheckAfterRewrite.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/CheckAfterRewrite.java index b1313a16a1..754d3efa58 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/CheckAfterRewrite.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/CheckAfterRewrite.java @@ -108,16 +108,18 @@ public class CheckAfterRewrite extends OneAnalysisRuleFactory { notFromChildren = removeValidSlotsNotFromChildren(notFromChildren, childrenOutput); if (!notFromChildren.isEmpty()) { if (plan.arity() != 0 && plan.child(0) instanceof LogicalAggregate) { - throw new AnalysisException(String.format("%s not in agg's output", notFromChildren + throw new AnalysisException(String.format("%s not in aggregate's output", notFromChildren .stream().map(NamedExpression::getName).collect(Collectors.joining(", ")))); } else { throw new AnalysisException(String.format( - "Input slot(s) not in child's output: %s in plan: %s," - + " child output is: %s\n" + "plan tree:\n" + plan.treeString(), + "Input slot(s) not in child's output: %s in plan: %s\nchild output is: %s\nplan tree:\n%s", StringUtils.join(notFromChildren.stream().map(ExpressionTrait::toString) .collect(Collectors.toSet()), ", "), - plan, plan.children().stream().flatMap(child -> child.getOutput().stream()) - .collect(Collectors.toSet()))); + plan, + plan.children().stream() + .flatMap(child -> child.getOutput().stream()) + .collect(Collectors.toSet()), + plan.treeString())); } } } diff --git a/regression-test/suites/nereids_p0/aggregate/aggregate.groovy b/regression-test/suites/nereids_p0/aggregate/aggregate.groovy index e9cb3b31b8..2446fcf092 100644 --- a/regression-test/suites/nereids_p0/aggregate/aggregate.groovy +++ b/regression-test/suites/nereids_p0/aggregate/aggregate.groovy @@ -334,7 +334,7 @@ suite("aggregate") { SELECT k1, k2 FROM tempbaseall GROUP BY k1; """ - exception "java.sql.SQLException: errCode = 2, detailMessage = k2 not in agg's output" + exception "java.sql.SQLException: errCode = 2, detailMessage = k2 not in aggregate's output" } test {