[fix](Nereids): LogicalRepeat equals lack @Override (#23408)
This commit is contained in:
@ -217,15 +217,9 @@ public class ColumnPruning extends DefaultPlanRewriter<PruneContext> implements
|
||||
.build());
|
||||
}
|
||||
|
||||
public static final <P extends Plan> P pruneOutput(P plan, List<NamedExpression> originOutput,
|
||||
Function<List<NamedExpression>, P> withPrunedOutput, PruneContext context) {
|
||||
Optional<List<NamedExpression>> prunedOutputs = pruneOutput(originOutput, context);
|
||||
return prunedOutputs.map(withPrunedOutput).orElse(plan);
|
||||
}
|
||||
|
||||
/** prune output */
|
||||
public static Optional<List<NamedExpression>> pruneOutput(
|
||||
List<NamedExpression> originOutput, PruneContext context) {
|
||||
public static <P extends Plan> P pruneOutput(P plan, List<NamedExpression> originOutput,
|
||||
Function<List<NamedExpression>, P> withPrunedOutput, PruneContext context) {
|
||||
List<NamedExpression> prunedOutputs = originOutput.stream()
|
||||
.filter(output -> context.requiredSlots.contains(output.toSlot()))
|
||||
.collect(ImmutableList.toImmutableList());
|
||||
@ -235,9 +229,11 @@ public class ColumnPruning extends DefaultPlanRewriter<PruneContext> implements
|
||||
prunedOutputs = ImmutableList.of(minimumColumn);
|
||||
}
|
||||
|
||||
return prunedOutputs.equals(originOutput)
|
||||
? Optional.empty()
|
||||
: Optional.of(prunedOutputs);
|
||||
if (prunedOutputs.equals(originOutput)) {
|
||||
return plan;
|
||||
} else {
|
||||
return withPrunedOutput.apply(prunedOutputs);
|
||||
}
|
||||
}
|
||||
|
||||
private <P extends Plan> P pruneChildren(P plan) {
|
||||
|
||||
@ -117,9 +117,7 @@ public class LogicalRepeat<CHILD_TYPE extends Plan> extends LogicalUnary<CHILD_T
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the equality with another plan
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
@ -127,9 +125,8 @@ public class LogicalRepeat<CHILD_TYPE extends Plan> extends LogicalUnary<CHILD_T
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
LogicalRepeat that = (LogicalRepeat) o;
|
||||
return Objects.equals(groupingSets, that.groupingSets)
|
||||
&& Objects.equals(outputExpressions, that.outputExpressions);
|
||||
LogicalRepeat<?> that = (LogicalRepeat<?>) o;
|
||||
return groupingSets.equals(that.groupingSets) && outputExpressions.equals(that.outputExpressions);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user