[fix](nereids) the project node is lost when creating PhysicalStorageLayerAggregate node (#15467)

This commit is contained in:
starocean999
2022-12-30 16:33:24 +08:00
committed by GitHub
parent 08d4dcefff
commit 93a25e1af5
4 changed files with 22 additions and 7 deletions

View File

@ -284,10 +284,16 @@ public class AggregateStrategies implements ImplementationRuleFactory {
.build()
.transform(olapScan, cascadesContext)
.get(0);
return aggregate.withChildren(ImmutableList.of(
new PhysicalStorageLayerAggregate(physicalOlapScan, mergeOp)
));
if (project != null) {
return aggregate.withChildren(ImmutableList.of(
project.withChildren(
ImmutableList.of(new PhysicalStorageLayerAggregate(physicalOlapScan, mergeOp)))
));
} else {
return aggregate.withChildren(ImmutableList.of(
new PhysicalStorageLayerAggregate(physicalOlapScan, mergeOp)
));
}
}
/**

View File

@ -120,7 +120,9 @@ public class PhysicalStorageLayerAggregateTest implements GeneratedPatterns {
.applyImplementation(storageLayerAggregateWithProject())
.matches(
logicalAggregate(
physicalStorageLayerAggregate().when(agg -> agg.getAggOp() == PushDownAggOp.MIN_MAX)
logicalProject(
physicalStorageLayerAggregate().when(agg -> agg.getAggOp() == PushDownAggOp.MIN_MAX)
)
)
);
@ -135,7 +137,9 @@ public class PhysicalStorageLayerAggregateTest implements GeneratedPatterns {
.applyImplementation(storageLayerAggregateWithProject())
.matches(
logicalAggregate(
physicalStorageLayerAggregate().when(agg -> agg.getAggOp() == PushDownAggOp.COUNT)
logicalProject(
physicalStorageLayerAggregate().when(agg -> agg.getAggOp() == PushDownAggOp.COUNT)
)
)
);
@ -152,7 +156,9 @@ public class PhysicalStorageLayerAggregateTest implements GeneratedPatterns {
.applyImplementation(storageLayerAggregateWithProject())
.matches(
logicalAggregate(
physicalStorageLayerAggregate().when(agg -> agg.getAggOp() == PushDownAggOp.MIX)
logicalProject(
physicalStorageLayerAggregate().when(agg -> agg.getAggOp() == PushDownAggOp.MIX)
)
)
);
}