This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 333d274d8b5 [fix](hudi) Fix Hudi query error "do not support DLA type 
HUDI" (#58413)
333d274d8b5 is described below

commit 333d274d8b5bcb4b52b81ec49f2a8c304b8d7a4c
Author: Socrates <[email protected]>
AuthorDate: Thu Nov 27 10:39:34 2025 +0800

    [fix](hudi) Fix Hudi query error "do not support DLA type HUDI" (#58413)
    
    ### What problem does this PR solve?
    
    Related PR: #56802
    
    Problem Summary:
    
    `LogicalHudiScan` did not override `withTableAlias()` and
    `withCachedOutput()` methods, causing HUDI table type information to be
    lost during optimization, and the table was incorrectly processed as
    `PhysicalFileScan`.
---
 .../glue/translator/PhysicalPlanTranslator.java    |  7 +++
 .../trees/plans/logical/LogicalHudiScan.java       | 55 ++++++++++++++++++----
 2 files changed, 54 insertions(+), 8 deletions(-)

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 dfc42ad653c..5368d8b0dc5 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 class PhysicalPlanTranslator extends 
DefaultPlanVisitor<PlanFragment, Pla
                                 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());
             }
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 d14da7f896e..0e10bb79920 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 @@ public class LogicalHudiScan extends LogicalFileScan {
             List<NamedExpression> virtualColumns,
             Optional<GroupExpression> groupExpression,
             Optional<LogicalProperties> logicalProperties,
+            String tableAlias,
             Optional<List<Slot>> 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<String> 
qualifier,
+            SelectedPartitions selectedPartitions, Optional<TableSample> 
tableSample,
+            Optional<TableSnapshot> tableSnapshot,
+            Optional<TableScanParams> scanParams, 
Optional<IncrementalRelation> incrementalRelation,
+            Collection<Slot> operativeSlots,
+            List<NamedExpression> virtualColumns,
+            Optional<GroupExpression> groupExpression,
+            Optional<LogicalProperties> logicalProperties,
+            Optional<List<Slot>> cachedOutputs) {
+        this(id, table, qualifier, selectedPartitions, tableSample, 
tableSnapshot, scanParams, incrementalRelation,
+                operativeSlots, virtualColumns, groupExpression, 
logicalProperties, "", cachedOutputs);
+    }
+
     public LogicalHudiScan(RelationId id, ExternalTable table, List<String> 
qualifier,
             Collection<Slot> operativeSlots, Optional<TableScanParams> 
scanParams,
             Optional<TableSample> tableSample, Optional<TableSnapshot> 
tableSnapshot,
@@ -142,7 +159,8 @@ public class LogicalHudiScan extends LogicalFileScan {
     public LogicalHudiScan withGroupExpression(Optional<GroupExpression> 
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 class LogicalHudiScan extends LogicalFileScan {
             Optional<LogicalProperties> logicalProperties, List<Plan> 
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 class LogicalHudiScan extends LogicalFileScan {
     }
 
     @Override
-    public LogicalFileScan withOperativeSlots(Collection<Slot> operativeSlots) 
{
+    public LogicalHudiScan withOperativeSlots(Collection<Slot> 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<Slot> 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 class LogicalHudiScan extends LogicalFileScan {
         }
         return new LogicalHudiScan(relationId, (ExternalTable) table, 
qualifier,
             selectedPartitions, tableSample, tableSnapshot, scanParams, 
newIncrementalRelation,
-            operativeSlots, virtualColumns, groupExpression, 
Optional.of(getLogicalProperties()), cachedOutputs);
+                operativeSlots, virtualColumns, groupExpression, 
Optional.of(getLogicalProperties()),
+                tableAlias, cachedOutputs);
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to