Skip to content

Commit

Permalink
[BugFix] Fix iceberg datacache auto populate failed (#51699) (#51724)
Browse files Browse the repository at this point in the history
Signed-off-by: Smith Cruise <[email protected]>
  • Loading branch information
Smith-Cruise authored Oct 11, 2024
1 parent 445391f commit ad70a95
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public Void visitPhysicalScan(OptExpression optExpression, TaskContext context)
}

// ignore full partition scan
if (checkIsFullPartitionScan(predicates)) {
if (checkIsFullPartitionScan(predicates, scanOperator.getOpType())) {
return rewritePhysicalScanOperator(scanOperator, false);
}

Expand Down Expand Up @@ -165,10 +165,18 @@ private boolean checkIsFullColumnScan(Table table, PhysicalScanOperator scanOper
return usedColumns == totalColumns;
}

private boolean checkIsFullPartitionScan(ScanOperatorPredicates scanOperatorPredicates) {
private boolean checkIsFullPartitionScan(ScanOperatorPredicates scanOperatorPredicates, OperatorType operatorType) {
if (operatorType == OperatorType.PHYSICAL_ICEBERG_SCAN ||
operatorType == OperatorType.PHYSICAL_DELTALAKE_SCAN ||
operatorType == OperatorType.PHYSICAL_PAIMON_SCAN) {
// For iceberg/delta lake is very expensive to get all partitions,
// so we didn't set the correct idToPartitionKey/selectedPartitionIds here.
// Paimon partition prune is after Optimizer (in PaimonScanNode#setupScanRangeLocations()).
// For the above cases, there is no need to check here.
return false;
}
if (scanOperatorPredicates.getIdToPartitionKey().size() <= 1) {
// for none-partition table, it has one partition id
// but delta lake's none-partition table, it has none partition id
return false;
}
return scanOperatorPredicates.getSelectedPartitionIds().size() ==
Expand Down

0 comments on commit ad70a95

Please sign in to comment.