[enhancement](nereids)throw readable exception when meet missing column in agg's output (#29243)

This commit is contained in:
starocean999
2024-01-03 12:59:32 +08:00
committed by GitHub
parent 12286f0a63
commit 193b7518ab
2 changed files with 20 additions and 8 deletions

View File

@ -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())));
}
}
}