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 193b7518aba [enhancement](nereids)throw readable exception when meet
missing column in agg's output (#29243)
193b7518aba is described below
commit 193b7518aba951dd4e8604bb18b782309ed845d0
Author: starocean999 <[email protected]>
AuthorDate: Wed Jan 3 12:59:32 2024 +0800
[enhancement](nereids)throw readable exception when meet missing column in
agg's output (#29243)
---
.../nereids/rules/analysis/CheckAfterRewrite.java | 20 ++++++++++++--------
.../suites/nereids_p0/aggregate/aggregate.groovy | 8 ++++++++
2 files changed, 20 insertions(+), 8 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 c43d794035a..56d5273e623 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
@@ -106,14 +106,18 @@ public class CheckAfterRewrite extends
OneAnalysisRuleFactory {
.collect(Collectors.toSet());
notFromChildren = removeValidSlotsNotFromChildren(notFromChildren,
childrenOutput);
if (!notFromChildren.isEmpty()) {
- 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(),
- StringUtils.join(notFromChildren.stream()
- .map(ExpressionTrait::toString)
- .collect(Collectors.toSet()), ", "), plan,
- plan.children().stream()
- .flatMap(child -> child.getOutput().stream())
- .collect(Collectors.toSet())));
+ if (plan.child(0) instanceof LogicalAggregate) {
+ throw new AnalysisException(String.format("%s not in agg's
output", notFromChildren
+ .stream().map(slot ->
slot.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(),
+
StringUtils.join(notFromChildren.stream().map(ExpressionTrait::toString)
+ .collect(Collectors.toSet()), ", "),
+ plan, plan.children().stream().flatMap(child ->
child.getOutput().stream())
+ .collect(Collectors.toSet())));
+ }
}
}
diff --git a/regression-test/suites/nereids_p0/aggregate/aggregate.groovy
b/regression-test/suites/nereids_p0/aggregate/aggregate.groovy
index f0ba091e045..6f63b146cb5 100644
--- a/regression-test/suites/nereids_p0/aggregate/aggregate.groovy
+++ b/regression-test/suites/nereids_p0/aggregate/aggregate.groovy
@@ -328,4 +328,12 @@ suite("aggregate") {
assertTrue(plan.contains("max(c_bigint"))
assertTrue(plan.contains("min(c_bigint"))
assertTrue(plan.contains("any_value(c_bigint"))
+
+ test {
+ sql """
+ SELECT k1, k2 FROM tempbaseall
+ GROUP BY k1;
+ """
+ exception "java.sql.SQLException: errCode = 2, detailMessage = k2 not
in agg's output"
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]