Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
924060929 committed Dec 12, 2024
1 parent 7c99257 commit 8c10ccf
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.doris.nereids.analyzer.MappingSlot;
import org.apache.doris.nereids.analyzer.Scope;
import org.apache.doris.nereids.analyzer.UnboundFunction;
import org.apache.doris.nereids.analyzer.UnboundInlineTable;
import org.apache.doris.nereids.analyzer.UnboundOneRowRelation;
import org.apache.doris.nereids.analyzer.UnboundResultSink;
import org.apache.doris.nereids.analyzer.UnboundSlot;
Expand Down Expand Up @@ -195,7 +196,7 @@ protected boolean condition(Rule rule, Plan plan) {
logicalQualify(logicalHaving()).thenApply(this::bindQualifyHaving)
),
RuleType.BINDING_INLINE_TABLE_SLOT.build(
logicalInlineTable().thenApply(this::bindInlineTable)
unboundInlineTable().thenApply(this::bindInlineTable)
),
RuleType.BINDING_ONE_ROW_RELATION_SLOT.build(
// we should bind UnboundAlias in the UnboundOneRowRelation
Expand Down Expand Up @@ -349,20 +350,20 @@ private LogicalOneRowRelation bindOneRowRelation(MatchingContext<UnboundOneRowRe
return new LogicalOneRowRelation(oneRowRelation.getRelationId(), projects);
}

private LogicalPlan bindInlineTable(MatchingContext<LogicalInlineTable> ctx) {
LogicalInlineTable logicalInlineTable = ctx.root;
private LogicalPlan bindInlineTable(MatchingContext<UnboundInlineTable> ctx) {
UnboundInlineTable inlineTable = ctx.root;
// ensure all expressions are valid.
List<LogicalPlan> relations
= Lists.newArrayListWithCapacity(logicalInlineTable.getConstantExprsList().size());
for (int i = 0; i < logicalInlineTable.getConstantExprsList().size(); i++) {
for (NamedExpression constantExpr : logicalInlineTable.getConstantExprsList().get(i)) {
= Lists.newArrayListWithCapacity(inlineTable.getConstantExprsList().size());
for (int i = 0; i < inlineTable.getConstantExprsList().size(); i++) {
for (NamedExpression constantExpr : inlineTable.getConstantExprsList().get(i)) {
if (constantExpr instanceof DefaultValueSlot) {
throw new AnalysisException("Default expression"
+ " can't exist in SELECT statement at row " + (i + 1));
}
}
relations.add(new UnboundOneRowRelation(StatementScopeIdGenerator.newRelationId(),
logicalInlineTable.getConstantExprsList().get(i)));
inlineTable.getConstantExprsList().get(i)));
}
// construct union all tree
return LogicalPlanBuilder.reduceToLogicalPlanTree(0, relations.size() - 1,
Expand Down

0 comments on commit 8c10ccf

Please sign in to comment.