[fix](Nereids) let with methods of plans use correct logical properties (#31447)
This commit is contained in:
@ -69,6 +69,8 @@ public class EliminateSort extends DefaultPlanRewriter<Boolean> implements Custo
|
||||
|
||||
@Override
|
||||
public Plan visitLogicalSink(LogicalSink<? extends Plan> sink, Boolean eliminateSort) {
|
||||
// 1. table sink: eliminate -> true
|
||||
// 2. sink -> tablesink -> olaptablesink
|
||||
return skipEliminateSort(sink, eliminateSort);
|
||||
}
|
||||
|
||||
|
||||
@ -122,8 +122,7 @@ public class LogicalCTEConsumer extends LogicalRelation implements BlockFuncDeps
|
||||
|
||||
public Plan withTwoMaps(Map<Slot, Slot> consumerToProducerOutputMap, Map<Slot, Slot> producerToConsumerOutputMap) {
|
||||
return new LogicalCTEConsumer(relationId, cteId, name,
|
||||
consumerToProducerOutputMap, producerToConsumerOutputMap,
|
||||
Optional.empty(), Optional.empty());
|
||||
consumerToProducerOutputMap, producerToConsumerOutputMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -66,7 +66,7 @@ public class LogicalEmptyRelation extends LogicalRelation
|
||||
}
|
||||
|
||||
public LogicalEmptyRelation withProjects(List<? extends NamedExpression> projects) {
|
||||
return new LogicalEmptyRelation(relationId, projects, Optional.empty(), Optional.empty());
|
||||
return new LogicalEmptyRelation(relationId, projects);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -80,11 +80,6 @@ public class LogicalGenerate<CHILD_TYPE extends Plan> extends LogicalUnary<CHILD
|
||||
return expandColumnAlias;
|
||||
}
|
||||
|
||||
public LogicalGenerate<Plan> withExpandColumnAlias(List<List<String>> expandColumnAlias) {
|
||||
return new LogicalGenerate<>(generators, generatorOutput, expandColumnAlias,
|
||||
Optional.empty(), Optional.of(getLogicalProperties()), child());
|
||||
}
|
||||
|
||||
@Override
|
||||
public LogicalGenerate<Plan> withChildren(List<Plan> children) {
|
||||
Preconditions.checkArgument(children.size() == 1);
|
||||
@ -110,8 +105,7 @@ public class LogicalGenerate<CHILD_TYPE extends Plan> extends LogicalUnary<CHILD
|
||||
for (int i = 0; i < generators.size(); i++) {
|
||||
newGeneratorOutput.add(generatorOutput.get(i).withNullable(generators.get(i).nullable()));
|
||||
}
|
||||
return new LogicalGenerate<>(generators, newGeneratorOutput, expandColumnAlias,
|
||||
Optional.empty(), Optional.of(getLogicalProperties()), child());
|
||||
return new LogicalGenerate<>(generators, newGeneratorOutput, expandColumnAlias, child());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -376,6 +376,9 @@ public class LogicalJoin<LEFT_CHILD_TYPE extends Plan, RIGHT_CHILD_TYPE extends
|
||||
ImmutableList.of(left, right), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Using in binding using join, and must set logical properties to empty.
|
||||
*/
|
||||
public LogicalJoin<Plan, Plan> withJoinConjuncts(List<Expression> hashJoinConjuncts,
|
||||
List<Expression> otherJoinConjuncts) {
|
||||
return new LogicalJoin<>(joinType, hashJoinConjuncts, otherJoinConjuncts, markJoinConjuncts,
|
||||
@ -387,7 +390,7 @@ public class LogicalJoin<LEFT_CHILD_TYPE extends Plan, RIGHT_CHILD_TYPE extends
|
||||
List<Expression> otherJoinConjuncts,
|
||||
List<Expression> markJoinConjuncts) {
|
||||
return new LogicalJoin<>(joinType, hashJoinConjuncts, otherJoinConjuncts, markJoinConjuncts,
|
||||
hint, markJoinSlotReference, Optional.empty(), Optional.empty(),
|
||||
hint, markJoinSlotReference, Optional.empty(), Optional.of(getLogicalProperties()),
|
||||
children, null);
|
||||
}
|
||||
|
||||
|
||||
@ -179,7 +179,8 @@ public class LogicalPartitionTopN<CHILD_TYPE extends Plan> extends LogicalUnary<
|
||||
|
||||
public LogicalPartitionTopN<Plan> withPartitionKeysAndOrderKeys(
|
||||
List<Expression> partitionKeys, List<OrderExpression> orderKeys) {
|
||||
return new LogicalPartitionTopN<>(function, partitionKeys, orderKeys, hasGlobalLimit, partitionLimit, child());
|
||||
return new LogicalPartitionTopN<>(function, partitionKeys, orderKeys, hasGlobalLimit, partitionLimit,
|
||||
Optional.empty(), Optional.of(getLogicalProperties()), child());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -188,7 +188,8 @@ public class LogicalProject<CHILD_TYPE extends Plan> extends LogicalUnary<CHILD_
|
||||
}
|
||||
|
||||
public LogicalProject<Plan> withEliminate(boolean isEliminate) {
|
||||
return new LogicalProject<>(projects, excepts, isDistinct, isEliminate, children);
|
||||
return new LogicalProject<>(projects, excepts, isDistinct, isEliminate,
|
||||
Optional.empty(), Optional.of(getLogicalProperties()), children);
|
||||
}
|
||||
|
||||
public LogicalProject<Plan> withProjects(List<NamedExpression> projects) {
|
||||
|
||||
@ -74,7 +74,7 @@ public class LogicalResultSink<CHILD_TYPE extends Plan> extends LogicalSink<CHIL
|
||||
|
||||
@Override
|
||||
public LogicalResultSink<CHILD_TYPE> withOutputExprs(List<NamedExpression> outputExprs) {
|
||||
return new LogicalResultSink<>(outputExprs, Optional.empty(), Optional.empty(), child());
|
||||
return new LogicalResultSink<>(outputExprs, child());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -133,8 +133,7 @@ public class LogicalTopN<CHILD_TYPE extends Plan> extends LogicalUnary<CHILD_TYP
|
||||
public LogicalTopN<Plan> withLimitChild(long limit, long offset, Plan child) {
|
||||
Preconditions.checkArgument(children.size() == 1,
|
||||
"LogicalTopN should have 1 child, but input is %s", children.size());
|
||||
return new LogicalTopN<>(orderKeys, limit, offset,
|
||||
Optional.empty(), Optional.of(getLogicalProperties()), child);
|
||||
return new LogicalTopN<>(orderKeys, limit, offset, child);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -175,11 +175,6 @@ public class LogicalUnion extends LogicalSetOperation implements Union, OutputPr
|
||||
Optional.empty(), Optional.empty(), children);
|
||||
}
|
||||
|
||||
public LogicalUnion withHasPushedFilter() {
|
||||
return new LogicalUnion(qualifier, outputs, regularChildrenOutputs, constantExprsList, true,
|
||||
Optional.empty(), Optional.empty(), children);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LogicalUnion pruneOutputs(List<NamedExpression> prunedOutputs) {
|
||||
return withNewOutputs(prunedOutputs);
|
||||
|
||||
@ -87,8 +87,7 @@ public class LogicalWindow<CHILD_TYPE extends Plan> extends LogicalUnary<CHILD_T
|
||||
}
|
||||
|
||||
public LogicalWindow<Plan> withExpression(List<NamedExpression> windowExpressions, Plan child) {
|
||||
return new LogicalWindow<>(windowExpressions, isChecked, Optional.empty(),
|
||||
Optional.empty(), child);
|
||||
return new LogicalWindow<>(windowExpressions, isChecked, child);
|
||||
}
|
||||
|
||||
public LogicalWindow<Plan> withChecked(List<NamedExpression> windowExpressions, Plan child) {
|
||||
|
||||
Reference in New Issue
Block a user