diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java index e16e851fe324da..c8b4a701a3b9bb 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java @@ -91,7 +91,6 @@ import org.apache.doris.nereids.trees.plans.physical.PhysicalCTEAnchor; import org.apache.doris.nereids.trees.plans.physical.PhysicalCTEConsumer; import org.apache.doris.nereids.trees.plans.physical.PhysicalCTEProducer; -import org.apache.doris.nereids.trees.plans.physical.PhysicalCatalogRelation; import org.apache.doris.nereids.trees.plans.physical.PhysicalDeferMaterializeOlapScan; import org.apache.doris.nereids.trees.plans.physical.PhysicalDeferMaterializeResultSink; import org.apache.doris.nereids.trees.plans.physical.PhysicalDeferMaterializeTopN; @@ -437,7 +436,7 @@ public PlanFragment visitPhysicalFileScan(PhysicalFileScan fileScan, PlanTransla } scanNode.addConjuncts(translateToLegacyConjuncts(fileScan.getConjuncts())); - scanNode.setPushDownAggNoGrouping(context.getTablePushAggOp(table.getId())); + scanNode.setPushDownAggNoGrouping(context.getRelationPushAggOp(fileScan.getRelationId())); TableName tableName = new TableName(null, "", ""); TableRef ref = new TableRef(tableName, null, null); @@ -576,6 +575,7 @@ public PlanFragment visitPhysicalOlapScan(PhysicalOlapScan olapScan, PlanTransla expr, olapScanNode, context) ) ); + olapScanNode.setPushDownAggNoGrouping(context.getRelationPushAggOp(olapScan.getRelationId())); // TODO: we need to remove all finalizeForNereids olapScanNode.finalizeForNereids(); // Create PlanFragment @@ -817,8 +817,8 @@ public PlanFragment visitPhysicalStorageLayerAggregate( + storageLayerAggregate.getAggOp()); } - context.setTablePushAggOp( - ((PhysicalCatalogRelation) storageLayerAggregate.getRelation()).getTable().getId(), pushAggOp); + context.setRelationPushAggOp( + storageLayerAggregate.getRelation().getRelationId(), pushAggOp); PlanFragment planFragment = storageLayerAggregate.getRelation().accept(this, context); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PlanTranslatorContext.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PlanTranslatorContext.java index 4e90d3eea251ae..4136def7017988 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PlanTranslatorContext.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PlanTranslatorContext.java @@ -32,6 +32,7 @@ import org.apache.doris.nereids.trees.expressions.ExprId; import org.apache.doris.nereids.trees.expressions.SlotReference; import org.apache.doris.nereids.trees.expressions.VirtualSlotReference; +import org.apache.doris.nereids.trees.plans.RelationId; import org.apache.doris.nereids.trees.plans.physical.PhysicalCTEConsumer; import org.apache.doris.nereids.trees.plans.physical.PhysicalCTEProducer; import org.apache.doris.nereids.trees.plans.physical.PhysicalHashAggregate; @@ -94,7 +95,7 @@ public class PlanTranslatorContext { private final Map cteScanNodeMap = Maps.newHashMap(); - private final Map tablePushAggOp = Maps.newHashMap(); + private final Map tablePushAggOp = Maps.newHashMap(); public PlanTranslatorContext(CascadesContext ctx) { this.translator = new RuntimeFilterTranslator(ctx.getRuntimeFilterContext()); @@ -239,11 +240,11 @@ public DescriptorTable getDescTable() { return descTable; } - public void setTablePushAggOp(Long tableId, TPushAggOp aggOp) { - tablePushAggOp.put(tableId, aggOp); + public void setRelationPushAggOp(RelationId relationId, TPushAggOp aggOp) { + tablePushAggOp.put(relationId, aggOp); } - public TPushAggOp getTablePushAggOp(Long tableId) { - return tablePushAggOp.getOrDefault(tableId, TPushAggOp.NONE); + public TPushAggOp getRelationPushAggOp(RelationId relationId) { + return tablePushAggOp.getOrDefault(relationId, TPushAggOp.NONE); } }