Cherry-picked from #48861 Co-authored-by: morrySnow <zhangwenxin@selectdb.com>
This commit is contained in:
committed by
GitHub
parent
13c174df4b
commit
a32a7ba5eb
@ -68,7 +68,7 @@ public class LogicalWindowToPhysicalWindow extends OneImplementationRuleFactory
|
||||
public Rule build() {
|
||||
|
||||
return RuleType.LOGICAL_WINDOW_TO_PHYSICAL_WINDOW_RULE.build(
|
||||
logicalWindow().when(LogicalWindow::isChecked).then(this::implement)
|
||||
logicalWindow().then(this::implement)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -149,7 +149,7 @@ public class LogicalPlanDeepCopier extends DefaultPlanRewriter<DeepCopierContext
|
||||
List<NamedExpression> outputExpressions = aggregate.getOutputExpressions().stream()
|
||||
.map(o -> (NamedExpression) ExpressionDeepCopier.INSTANCE.deepCopy(o, context))
|
||||
.collect(ImmutableList.toImmutableList());
|
||||
return new LogicalAggregate<>(groupByExpressions, outputExpressions, child);
|
||||
return aggregate.withChildGroupByAndOutput(groupByExpressions, outputExpressions, child);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -194,7 +194,10 @@ public class LogicalPlanDeepCopier extends DefaultPlanRewriter<DeepCopierContext
|
||||
List<NamedExpression> newProjects = project.getProjects().stream()
|
||||
.map(p -> (NamedExpression) ExpressionDeepCopier.INSTANCE.deepCopy(p, context))
|
||||
.collect(ImmutableList.toImmutableList());
|
||||
return new LogicalProject<>(newProjects, child);
|
||||
List<NamedExpression> newExcepts = project.getExcepts().stream()
|
||||
.map(p -> (NamedExpression) ExpressionDeepCopier.INSTANCE.deepCopy(p, context))
|
||||
.collect(ImmutableList.toImmutableList());
|
||||
return new LogicalProject<>(newProjects, newExcepts, project.isDistinct(), child);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -353,7 +356,7 @@ public class LogicalPlanDeepCopier extends DefaultPlanRewriter<DeepCopierContext
|
||||
List<Slot> generatorOutput = generate.getGeneratorOutput().stream()
|
||||
.map(o -> (Slot) ExpressionDeepCopier.INSTANCE.deepCopy(o, context))
|
||||
.collect(ImmutableList.toImmutableList());
|
||||
return new LogicalGenerate<>(generators, generatorOutput, child);
|
||||
return new LogicalGenerate<>(generators, generatorOutput, generate.getExpandColumnAlias(), child);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -362,7 +365,7 @@ public class LogicalPlanDeepCopier extends DefaultPlanRewriter<DeepCopierContext
|
||||
List<NamedExpression> windowExpressions = window.getWindowExpressions().stream()
|
||||
.map(w -> (NamedExpression) ExpressionDeepCopier.INSTANCE.deepCopy(w, context))
|
||||
.collect(ImmutableList.toImmutableList());
|
||||
return new LogicalWindow<>(windowExpressions, child);
|
||||
return new LogicalWindow<>(windowExpressions, window.isChecked(), child);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -273,6 +273,12 @@ public class LogicalAggregate<CHILD_TYPE extends Plan>
|
||||
hasPushed, sourceRepeat, Optional.empty(), Optional.empty(), child());
|
||||
}
|
||||
|
||||
public LogicalAggregate<Plan> withChildGroupByAndOutput(List<Expression> groupByExpressions,
|
||||
List<NamedExpression> outputExpressions, Plan child) {
|
||||
return new LogicalAggregate<>(groupByExpressions, outputExpressions, normalized, ordinalIsResolved, generated,
|
||||
hasPushed, sourceRepeat, Optional.empty(), Optional.empty(), child);
|
||||
}
|
||||
|
||||
public LogicalAggregate<Plan> withChildAndOutput(CHILD_TYPE child,
|
||||
List<NamedExpression> outputExpressionList) {
|
||||
return new LogicalAggregate<>(groupByExpressions, outputExpressionList, normalized, ordinalIsResolved,
|
||||
|
||||
@ -65,10 +65,6 @@ public class LogicalEmptyRelation extends LogicalRelation
|
||||
return projects;
|
||||
}
|
||||
|
||||
public LogicalEmptyRelation withProjects(List<? extends NamedExpression> projects) {
|
||||
return new LogicalEmptyRelation(relationId, projects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plan withGroupExpression(Optional<GroupExpression> groupExpression) {
|
||||
return new LogicalEmptyRelation(relationId, projects,
|
||||
@ -86,6 +82,14 @@ public class LogicalEmptyRelation extends LogicalRelation
|
||||
throw new RuntimeException("should not call LogicalEmptyRelation's withRelationId method");
|
||||
}
|
||||
|
||||
public LogicalEmptyRelation withProjects(List<NamedExpression> projects) {
|
||||
return new LogicalEmptyRelation(relationId, projects);
|
||||
}
|
||||
|
||||
public LogicalEmptyRelation withRelationIdAndProjects(RelationId relationId, List<NamedExpression> projects) {
|
||||
return new LogicalEmptyRelation(relationId, projects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Slot> computeOutput() {
|
||||
return projects.stream()
|
||||
|
||||
@ -94,6 +94,10 @@ public class LogicalOneRowRelation extends LogicalRelation implements OneRowRela
|
||||
throw new RuntimeException("should not call LogicalOneRowRelation's withRelationId method");
|
||||
}
|
||||
|
||||
public LogicalOneRowRelation withRelationIdAndProjects(RelationId relationId, List<NamedExpression> projects) {
|
||||
return new LogicalOneRowRelation(relationId, projects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Slot> computeOutput() {
|
||||
return projects.stream()
|
||||
|
||||
Reference in New Issue
Block a user