Skip to content

Commit df06507

Browse files
[fix](hudi) fix hudi scan problem (apache#51489)
### What problem does this PR solve? Related PR: apache#51329 Problem Summary: The `LogicalHudiScan` class should overload the method `withOperativeSlots` and return the `LogicalHudiScan` type. Otherwise, the `LogicalFileScanToPhysicalFileScan` rule will be incorrectly applied when querying the hudi table, resulting in the generation of `PhysicalFileScan`. Because `plan` is `LogicalFileScan`, `plan -> !(plan instanceof LogicalHudiScan)` will incorrectly return true. ```java public class LogicalFileScanToPhysicalFileScan extends OneImplementationRuleFactory { @OverRide public Rule build() { return logicalFileScan().when(plan -> !(plan instanceof LogicalHudiScan)).then(fileScan -> new PhysicalFileScan( fileScan.getRelationId(), fileScan.getTable(), fileScan.getQualifier(), DistributionSpecAny.INSTANCE, Optional.empty(), fileScan.getLogicalProperties(), fileScan.getSelectedPartitions(), fileScan.getTableSample(), fileScan.getTableSnapshot(), fileScan.getOperativeSlots()) ).toRule(RuleType.LOGICAL_FILE_SCAN_TO_PHYSICAL_FILE_SCAN_RULE); } } ```
1 parent 1e3cacd commit df06507

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalHudiScan.java‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import org.apache.logging.log4j.LogManager;
4949
import org.apache.logging.log4j.Logger;
5050

51+
import java.util.Collection;
5152
import java.util.Collections;
5253
import java.util.List;
5354
import java.util.Map;
@@ -73,7 +74,7 @@ protected LogicalHudiScan(RelationId id, ExternalTable table, List<String> quali
7374
SelectedPartitions selectedPartitions, Optional<TableSample> tableSample,
7475
Optional<TableSnapshot> tableSnapshot,
7576
Optional<TableScanParams> scanParams, Optional<IncrementalRelation> incrementalRelation,
76-
List<Slot> operativeSlots) {
77+
Collection<Slot> operativeSlots) {
7778
super(id, table, qualifier, groupExpression, logicalProperties,
7879
selectedPartitions, tableSample, tableSnapshot, operativeSlots);
7980
Objects.requireNonNull(scanParams, "scanParams should not null");
@@ -83,7 +84,7 @@ protected LogicalHudiScan(RelationId id, ExternalTable table, List<String> quali
8384
}
8485

8586
public LogicalHudiScan(RelationId id, ExternalTable table, List<String> qualifier,
86-
Optional<TableSample> tableSample, Optional<TableSnapshot> tableSnapshot, List<Slot> operativeSlots) {
87+
Optional<TableSample> tableSample, Optional<TableSnapshot> tableSnapshot, Collection<Slot> operativeSlots) {
8788
this(id, table, qualifier, Optional.empty(), Optional.empty(),
8889
((HMSExternalTable) table).initHudiSelectedPartitions(tableSnapshot), tableSample, tableSnapshot,
8990
Optional.empty(), Optional.empty(),
@@ -167,6 +168,14 @@ public <R, C> R accept(PlanVisitor<R, C> visitor, C context) {
167168
return visitor.visitLogicalHudiScan(this, context);
168169
}
169170

171+
@Override
172+
public LogicalFileScan withOperativeSlots(Collection<Slot> operativeSlots) {
173+
return new LogicalHudiScan(relationId, (ExternalTable) table, qualifier,
174+
groupExpression, Optional.of(getLogicalProperties()),
175+
selectedPartitions, tableSample, tableSnapshot, scanParams, incrementalRelation,
176+
operativeSlots);
177+
}
178+
170179
/**
171180
* Set scan params for incremental read
172181
*

0 commit comments

Comments
 (0)