From 083c65f516011e2b600c15b785b3e70192b3a288 Mon Sep 17 00:00:00 2001 From: Socrates Date: Wed, 26 Nov 2025 17:19:01 +0800 Subject: [PATCH 1/2] add more info --- .../nereids/glue/translator/PhysicalPlanTranslator.java | 7 +++++++ 1 file changed, 7 insertions(+) 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 dfc42ad653c5d7..5368d8b0dc52e6 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 @@ -655,6 +655,13 @@ public PlanFragment visitPhysicalFileScan(PhysicalFileScan fileScan, PlanTransla fileScan.getTableSample().get().sampleValue, fileScan.getTableSample().get().seek)); } break; + case HUDI: + // HUDI table should be handled by visitPhysicalHudiScan, not here. + // If we reach here, it means LogicalHudiScan was incorrectly converted to + // PhysicalFileScan. + throw new RuntimeException("HUDI table should use PhysicalHudiScan instead of PhysicalFileScan. " + + "This indicates a bug in the optimizer rules. " + + "FileScan class: " + fileScan.getClass().getSimpleName()); default: throw new RuntimeException("do not support DLA type " + ((HMSExternalTable) table).getDlaType()); } From 4bc4f7e4b4f9022014d61883c3e4f7bcabbd2cd9 Mon Sep 17 00:00:00 2001 From: Socrates Date: Wed, 26 Nov 2025 17:43:30 +0800 Subject: [PATCH 2/2] fix --- .../trees/plans/logical/LogicalHudiScan.java | 55 ++++++++++++++++--- 1 file changed, 47 insertions(+), 8 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalHudiScan.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalHudiScan.java index d14da7f896ed56..0e10bb79920fb1 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalHudiScan.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalHudiScan.java @@ -78,14 +78,31 @@ protected LogicalHudiScan(RelationId id, ExternalTable table, List quali List virtualColumns, Optional groupExpression, Optional logicalProperties, + String tableAlias, Optional> cachedOutputs) { super(id, table, qualifier, selectedPartitions, operativeSlots, virtualColumns, - tableSample, tableSnapshot, scanParams, groupExpression, logicalProperties, "", cachedOutputs); + tableSample, tableSnapshot, scanParams, groupExpression, logicalProperties, tableAlias, cachedOutputs); Objects.requireNonNull(scanParams, "scanParams should not null"); Objects.requireNonNull(incrementalRelation, "incrementalRelation should not null"); this.incrementalRelation = incrementalRelation; } + /** + * Constructor for LogicalHudiScan (backward compatibility without tableAlias). + */ + protected LogicalHudiScan(RelationId id, ExternalTable table, List qualifier, + SelectedPartitions selectedPartitions, Optional tableSample, + Optional tableSnapshot, + Optional scanParams, Optional incrementalRelation, + Collection operativeSlots, + List virtualColumns, + Optional groupExpression, + Optional logicalProperties, + Optional> cachedOutputs) { + this(id, table, qualifier, selectedPartitions, tableSample, tableSnapshot, scanParams, incrementalRelation, + operativeSlots, virtualColumns, groupExpression, logicalProperties, "", cachedOutputs); + } + public LogicalHudiScan(RelationId id, ExternalTable table, List qualifier, Collection operativeSlots, Optional scanParams, Optional tableSample, Optional tableSnapshot, @@ -142,7 +159,8 @@ public String toString() { public LogicalHudiScan withGroupExpression(Optional groupExpression) { return new LogicalHudiScan(relationId, (ExternalTable) table, qualifier, selectedPartitions, tableSample, tableSnapshot, scanParams, incrementalRelation, - operativeSlots, virtualColumns, groupExpression, Optional.of(getLogicalProperties()), cachedOutputs); + operativeSlots, virtualColumns, groupExpression, Optional.of(getLogicalProperties()), + tableAlias, cachedOutputs); } @Override @@ -150,20 +168,23 @@ public Plan withGroupExprLogicalPropChildren(Optional groupExpr Optional logicalProperties, List children) { return new LogicalHudiScan(relationId, (ExternalTable) table, qualifier, selectedPartitions, tableSample, tableSnapshot, scanParams, incrementalRelation, - operativeSlots, virtualColumns, groupExpression, logicalProperties, cachedOutputs); + operativeSlots, virtualColumns, groupExpression, logicalProperties, + tableAlias, cachedOutputs); } public LogicalHudiScan withSelectedPartitions(SelectedPartitions selectedPartitions) { return new LogicalHudiScan(relationId, (ExternalTable) table, qualifier, selectedPartitions, tableSample, tableSnapshot, scanParams, incrementalRelation, - operativeSlots, virtualColumns, groupExpression, Optional.of(getLogicalProperties()), cachedOutputs); + operativeSlots, virtualColumns, groupExpression, Optional.of(getLogicalProperties()), + tableAlias, cachedOutputs); } @Override public LogicalHudiScan withRelationId(RelationId relationId) { return new LogicalHudiScan(relationId, (ExternalTable) table, qualifier, selectedPartitions, tableSample, tableSnapshot, scanParams, incrementalRelation, - operativeSlots, virtualColumns, groupExpression, Optional.of(getLogicalProperties()), cachedOutputs); + operativeSlots, virtualColumns, groupExpression, Optional.of(getLogicalProperties()), + tableAlias, cachedOutputs); } @Override @@ -172,10 +193,27 @@ public R accept(PlanVisitor visitor, C context) { } @Override - public LogicalFileScan withOperativeSlots(Collection operativeSlots) { + public LogicalHudiScan withOperativeSlots(Collection operativeSlots) { + return new LogicalHudiScan(relationId, (ExternalTable) table, qualifier, + selectedPartitions, tableSample, tableSnapshot, scanParams, incrementalRelation, + operativeSlots, virtualColumns, groupExpression, Optional.of(getLogicalProperties()), + tableAlias, cachedOutputs); + } + + @Override + public LogicalHudiScan withTableAlias(String tableAlias) { + return new LogicalHudiScan(relationId, (ExternalTable) table, qualifier, + selectedPartitions, tableSample, tableSnapshot, scanParams, incrementalRelation, + operativeSlots, virtualColumns, Optional.empty(), Optional.of(getLogicalProperties()), + tableAlias, cachedOutputs); + } + + @Override + public LogicalHudiScan withCachedOutput(List cachedOutputs) { return new LogicalHudiScan(relationId, (ExternalTable) table, qualifier, selectedPartitions, tableSample, tableSnapshot, scanParams, incrementalRelation, - operativeSlots, virtualColumns, groupExpression, Optional.of(getLogicalProperties()), cachedOutputs); + operativeSlots, virtualColumns, groupExpression, Optional.empty(), + tableAlias, Optional.of(cachedOutputs)); } /** @@ -228,6 +266,7 @@ public LogicalHudiScan withScanParams(HMSExternalTable table, Optional