Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](iceberg) fix iceberg count(*) short circuit read bug #23402

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
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;
Expand Down Expand Up @@ -434,7 +435,9 @@ public PlanFragment visitPhysicalFileScan(PhysicalFileScan fileScan, PlanTransla
} else {
throw new RuntimeException("do not support table type " + table.getType());
}

scanNode.addConjuncts(translateToLegacyConjuncts(fileScan.getConjuncts()));
scanNode.setPushDownAggNoGrouping(context.getTablePushAggOp(table.getId()));

TableName tableName = new TableName(null, "", "");
TableRef ref = new TableRef(tableName, null, null);
Expand Down Expand Up @@ -797,9 +800,7 @@ public PlanFragment visitPhysicalStorageLayerAggregate(
|| storageLayerAggregate.getRelation() instanceof PhysicalFileScan),
"PhysicalStorageLayerAggregate only support PhysicalOlapScan and PhysicalFileScan: "
+ storageLayerAggregate.getRelation().getClass().getName());
PlanFragment planFragment = storageLayerAggregate.getRelation().accept(this, context);

ScanNode scanNode = (ScanNode) planFragment.getPlanRoot();
TPushAggOp pushAggOp;
switch (storageLayerAggregate.getAggOp()) {
case COUNT:
Expand All @@ -815,7 +816,12 @@ public PlanFragment visitPhysicalStorageLayerAggregate(
throw new AnalysisException("Unsupported storage layer aggregate: "
+ storageLayerAggregate.getAggOp());
}
scanNode.setPushDownAggNoGrouping(pushAggOp);

context.setTablePushAggOp(
((PhysicalCatalogRelation) storageLayerAggregate.getRelation()).getTable().getId(), pushAggOp);

PlanFragment planFragment = storageLayerAggregate.getRelation().accept(this, context);

updateLegacyPlanIdToPhysicalPlan(planFragment.getPlanRoot(), storageLayerAggregate);
return planFragment;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.apache.doris.planner.PlanNode;
import org.apache.doris.planner.PlanNodeId;
import org.apache.doris.planner.ScanNode;
import org.apache.doris.thrift.TPushAggOp;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
Expand Down Expand Up @@ -93,6 +94,8 @@ public class PlanTranslatorContext {

private final Map<PlanFragmentId, CTEScanNode> cteScanNodeMap = Maps.newHashMap();

private final Map<Long, TPushAggOp> tablePushAggOp = Maps.newHashMap();

public PlanTranslatorContext(CascadesContext ctx) {
this.translator = new RuntimeFilterTranslator(ctx.getRuntimeFilterContext());
}
Expand Down Expand Up @@ -235,4 +238,12 @@ public TupleDescriptor getTupleDesc(TupleId tupleId) {
public DescriptorTable getDescTable() {
return descTable;
}

public void setTablePushAggOp(Long tableId, TPushAggOp aggOp) {
tablePushAggOp.put(tableId, aggOp);
}

public TPushAggOp getTablePushAggOp(Long tableId) {
return tablePushAggOp.getOrDefault(tableId, TPushAggOp.NONE);
}
}