[fix](Nereids): fix LogicalProject withXXX(). (#18441)
This commit is contained in:
@ -25,12 +25,12 @@ import org.apache.doris.qe.ConnectContext;
|
||||
* according different operator
|
||||
*/
|
||||
public interface Cost {
|
||||
public double getValue();
|
||||
double getValue();
|
||||
|
||||
/**
|
||||
* This is for calculating the cost in simplifier
|
||||
*/
|
||||
public static Cost withRowCount(double rowCount) {
|
||||
static Cost withRowCount(double rowCount) {
|
||||
if (ConnectContext.get().getSessionVariable().getEnableNewCostModel()) {
|
||||
return new CostV2(0, rowCount, 0);
|
||||
}
|
||||
@ -40,17 +40,14 @@ public interface Cost {
|
||||
/**
|
||||
* return zero cost
|
||||
*/
|
||||
public static Cost zero() {
|
||||
static Cost zero() {
|
||||
if (ConnectContext.get().getSessionVariable().getEnableNewCostModel()) {
|
||||
return CostV2.zero();
|
||||
}
|
||||
return CostV1.zero();
|
||||
}
|
||||
|
||||
/**
|
||||
* return infinite cost
|
||||
*/
|
||||
public static Cost infinite() {
|
||||
static Cost infinite() {
|
||||
if (ConnectContext.get().getSessionVariable().getEnableNewCostModel()) {
|
||||
return CostV2.infinite();
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ public class BindRelation extends OneAnalysisRuleFactory {
|
||||
scan = scan.withPreAggStatus(PreAggStatus.off(
|
||||
Column.DELETE_SIGN + " is used as conjuncts."));
|
||||
}
|
||||
return new LogicalFilter(Sets.newHashSet(conjunct), scan);
|
||||
return new LogicalFilter<>(Sets.newHashSet(conjunct), scan);
|
||||
}
|
||||
return scan;
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ public class AdjustNullable implements RewriteRuleFactory {
|
||||
RuleType.ADJUST_NULLABLE_ON_PROJECT.build(logicalProject().then(project -> {
|
||||
Map<ExprId, Slot> exprIdSlotMap = collectChildrenOutputMap(project);
|
||||
List<NamedExpression> newProjects = updateExpressions(project.getProjects(), exprIdSlotMap);
|
||||
return project.withProjects(newProjects).recomputeLogicalProperties();
|
||||
return project.withProjects(newProjects);
|
||||
})),
|
||||
RuleType.ADJUST_NULLABLE_ON_REPEAT.build(logicalRepeat().then(repeat -> {
|
||||
Map<ExprId, Slot> exprIdSlotMap = collectChildrenOutputMap(repeat);
|
||||
|
||||
@ -155,26 +155,12 @@ public class LogicalProject<CHILD_TYPE extends Plan> extends LogicalUnary<CHILD_
|
||||
return Objects.hash(projects, canEliminate);
|
||||
}
|
||||
|
||||
public LogicalProject<Plan> withEliminate(boolean isEliminate) {
|
||||
return new LogicalProject<>(projects, excepts, isEliminate, child(), isDistinct);
|
||||
}
|
||||
|
||||
public LogicalProject<Plan> withProjects(List<NamedExpression> projects) {
|
||||
return new LogicalProject<>(projects, excepts, canEliminate,
|
||||
Optional.empty(), Optional.of(getLogicalProperties()), child(), isDistinct);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LogicalProject<Plan> withChildren(List<Plan> children) {
|
||||
Preconditions.checkArgument(children.size() == 1);
|
||||
return new LogicalProject<>(projects, excepts, canEliminate, children.get(0), isDistinct);
|
||||
}
|
||||
|
||||
public LogicalProject<Plan> withProjectsAndChild(List<NamedExpression> projects, Plan child) {
|
||||
return new LogicalProject<>(projects, excepts, canEliminate,
|
||||
Optional.empty(), Optional.empty(), child, isDistinct);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LogicalProject<Plan> withGroupExpression(Optional<GroupExpression> groupExpression) {
|
||||
return new LogicalProject<>(projects, excepts, canEliminate,
|
||||
@ -187,6 +173,18 @@ public class LogicalProject<CHILD_TYPE extends Plan> extends LogicalUnary<CHILD_
|
||||
isDistinct);
|
||||
}
|
||||
|
||||
public LogicalProject<Plan> withEliminate(boolean isEliminate) {
|
||||
return new LogicalProject<>(projects, excepts, isEliminate, child(), isDistinct);
|
||||
}
|
||||
|
||||
public LogicalProject<Plan> withProjects(List<NamedExpression> projects) {
|
||||
return new LogicalProject<>(projects, excepts, canEliminate, child(), isDistinct);
|
||||
}
|
||||
|
||||
public LogicalProject<Plan> withProjectsAndChild(List<NamedExpression> projects, Plan child) {
|
||||
return new LogicalProject<>(projects, excepts, canEliminate, child, isDistinct);
|
||||
}
|
||||
|
||||
public boolean canEliminate() {
|
||||
return canEliminate;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user