hubgeter commented on code in PR #22115:
URL: https://github.com/apache/doris/pull/22115#discussion_r1272557233
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java:
##########
@@ -310,19 +338,41 @@ private LogicalAggregate<? extends Plan>
storageLayerAggregate(
}
}
- PhysicalOlapScan physicalOlapScan = (PhysicalOlapScan) new
LogicalOlapScanToPhysicalOlapScan()
- .build()
- .transform(olapScan, cascadesContext)
- .get(0);
- if (project != null) {
- return aggregate.withChildren(ImmutableList.of(
+ if (logicalScan instanceof LogicalOlapScan) {
+ PhysicalOlapScan physicalScan = (PhysicalOlapScan) new
LogicalOlapScanToPhysicalOlapScan()
+ .build()
+ .transform((LogicalOlapScan) logicalScan, cascadesContext)
+ .get(0);
+
+ if (project != null) {
+ return aggregate.withChildren(ImmutableList.of(
project.withChildren(
- ImmutableList.of(new
PhysicalStorageLayerAggregate(physicalOlapScan, mergeOp)))
- ));
+ ImmutableList.of(new
PhysicalStorageLayerAggregate(physicalScan, mergeOp)))
+ ));
+ } else {
+ return aggregate.withChildren(ImmutableList.of(
+ new PhysicalStorageLayerAggregate(physicalScan, mergeOp)
+ ));
+ }
+
+ } else if (logicalScan instanceof LogicalFileScan) {
+ PhysicalFileScan physicalScan = (PhysicalFileScan) new
LogicalFileScanToPhysicalFileScan()
+ .build()
+ .transform((LogicalFileScan) logicalScan, cascadesContext)
+ .get(0);
+ if (project != null) {
+ return aggregate.withChildren(ImmutableList.of(
+ project.withChildren(
+ ImmutableList.of(new
PhysicalStorageLayerAggregate(physicalScan, mergeOp)))
+ ));
+ } else {
+ return aggregate.withChildren(ImmutableList.of(
+ new PhysicalStorageLayerAggregate(physicalScan, mergeOp)
+ ));
+ }
+
} else {
- return aggregate.withChildren(ImmutableList.of(
- new PhysicalStorageLayerAggregate(physicalOlapScan,
mergeOp)
- ));
+ return canNotPush;
Review Comment:
if you want
```java
PhysicalOlapScan physicalScan;
if (logicalScan instanceof LogicalOlapScan) {
physicalScan = (PhysicalOlapScan) new
LogicalOlapScanToPhysicalOlapScan()
.build()
.transform((LogicalOlapScan) logicalScan,
cascadesContext)
.get(0);
} else if (logicalScan instanceof LogicalFileScan) {
physicalScan = (PhysicalFileScan) new
LogicalFileScanToPhysicalFileScan()
.build()
.transform((LogicalFileScan) logicalScan,
cascadesContext)
.get(0);
} else {
return canNotPush;
}
if (project != null) {
return aggregate.withChildren(ImmutableList.of(
project.withChildren(
ImmutableList.of(new
PhysicalStorageLayerAggregate(physicalScan, mergeOp)))
));
} else {
return aggregate.withChildren(ImmutableList.of(
new PhysicalStorageLayerAggregate(physicalScan, mergeOp)
));
}
```
you will get this:
```
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile)
on project fe-core: Compilation failure: Compilation failure:
[ERROR]
/mnt/datadisk1/changyuwei/doris2/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java:[345,72]
incompatible types:
org.apache.doris.nereids.trees.plans.physical.PhysicalRelation cannot be
converted to
org.apache.doris.nereids.trees.plans.physical.PhysicalCatalogRelation
[ERROR]
/mnt/datadisk1/changyuwei/doris2/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java:[349,51]
incompatible types:
org.apache.doris.nereids.trees.plans.physical.PhysicalRelation cannot be
converted to
org.apache.doris.nereids.trees.plans.physical.PhysicalCatalogRelation
```
ðŸ˜ðŸ˜¤ðŸ˜
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java:
##########
@@ -310,19 +338,41 @@ private LogicalAggregate<? extends Plan>
storageLayerAggregate(
}
}
- PhysicalOlapScan physicalOlapScan = (PhysicalOlapScan) new
LogicalOlapScanToPhysicalOlapScan()
- .build()
- .transform(olapScan, cascadesContext)
- .get(0);
- if (project != null) {
- return aggregate.withChildren(ImmutableList.of(
+ if (logicalScan instanceof LogicalOlapScan) {
+ PhysicalOlapScan physicalScan = (PhysicalOlapScan) new
LogicalOlapScanToPhysicalOlapScan()
+ .build()
+ .transform((LogicalOlapScan) logicalScan, cascadesContext)
+ .get(0);
+
+ if (project != null) {
+ return aggregate.withChildren(ImmutableList.of(
project.withChildren(
- ImmutableList.of(new
PhysicalStorageLayerAggregate(physicalOlapScan, mergeOp)))
- ));
+ ImmutableList.of(new
PhysicalStorageLayerAggregate(physicalScan, mergeOp)))
+ ));
+ } else {
+ return aggregate.withChildren(ImmutableList.of(
+ new PhysicalStorageLayerAggregate(physicalScan, mergeOp)
+ ));
+ }
+
+ } else if (logicalScan instanceof LogicalFileScan) {
+ PhysicalFileScan physicalScan = (PhysicalFileScan) new
LogicalFileScanToPhysicalFileScan()
+ .build()
+ .transform((LogicalFileScan) logicalScan, cascadesContext)
+ .get(0);
+ if (project != null) {
+ return aggregate.withChildren(ImmutableList.of(
+ project.withChildren(
+ ImmutableList.of(new
PhysicalStorageLayerAggregate(physicalScan, mergeOp)))
+ ));
+ } else {
+ return aggregate.withChildren(ImmutableList.of(
+ new PhysicalStorageLayerAggregate(physicalScan, mergeOp)
+ ));
+ }
+
} else {
- return aggregate.withChildren(ImmutableList.of(
- new PhysicalStorageLayerAggregate(physicalOlapScan,
mergeOp)
- ));
+ return canNotPush;
Review Comment:
if you want
```java
PhysicalOlapScan physicalScan;
if (logicalScan instanceof LogicalOlapScan) {
physicalScan = (PhysicalOlapScan) new
LogicalOlapScanToPhysicalOlapScan()
.build()
.transform((LogicalOlapScan) logicalScan,
cascadesContext)
.get(0);
} else if (logicalScan instanceof LogicalFileScan) {
physicalScan = (PhysicalFileScan) new
LogicalFileScanToPhysicalFileScan()
.build()
.transform((LogicalFileScan) logicalScan,
cascadesContext)
.get(0);
} else {
return canNotPush;
}
if (project != null) {
return aggregate.withChildren(ImmutableList.of(
project.withChildren(
ImmutableList.of(new
PhysicalStorageLayerAggregate(physicalScan, mergeOp)))
));
} else {
return aggregate.withChildren(ImmutableList.of(
new PhysicalStorageLayerAggregate(physicalScan, mergeOp)
));
}
```
you will get this:
```
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile)
on project fe-core: Compilation failure: Compilation failure:
[ERROR]
/mnt/datadisk1/changyuwei/doris2/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java:[345,72]
incompatible types:
org.apache.doris.nereids.trees.plans.physical.PhysicalRelation cannot be
converted to
org.apache.doris.nereids.trees.plans.physical.PhysicalCatalogRelation
[ERROR]
/mnt/datadisk1/changyuwei/doris2/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java:[349,51]
incompatible types:
org.apache.doris.nereids.trees.plans.physical.PhysicalRelation cannot be
converted to
org.apache.doris.nereids.trees.plans.physical.PhysicalCatalogRelation
```
ðŸ˜ðŸ˜¤ðŸ˜
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]