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

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


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 7c8df011c1a branch-4.0: Fix: Ensure HUDI tables are processed 
correctly by throwing an error for incorrect PhysicalFileScan usage (#59709)
7c8df011c1a is described below

commit 7c8df011c1a7fa954fcddf719cd876e3178fe893
Author: Socrates <[email protected]>
AuthorDate: Sat Jan 10 11:36:55 2026 +0800

    branch-4.0: Fix: Ensure HUDI tables are processed correctly by throwing an 
error for incorrect PhysicalFileScan usage (#59709)
    
    bp: #58413
    LogicalHudiScan did not override withCachedOutput() method, causing HUDI
    table type information to be lost during optimization, and the table was
    incorrectly processed as PhysicalFileScan.
---
 .../doris/nereids/glue/translator/PhysicalPlanTranslator.java     | 7 +++++++
 .../apache/doris/nereids/trees/plans/logical/LogicalHudiScan.java | 8 ++++++++
 2 files changed, 15 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 fb36b039947..0e452b04939 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
@@ -656,6 +656,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 c4615c6ddd0..be9dc632de5 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
@@ -178,6 +178,14 @@ public class LogicalHudiScan extends LogicalFileScan {
             operativeSlots, virtualColumns, groupExpression, 
Optional.of(getLogicalProperties()), cachedOutputs);
     }
 
+    @Override
+    public LogicalFileScan withCachedOutput(List<Slot> cachedOutputs) {
+        return new LogicalHudiScan(relationId, (ExternalTable) table, 
qualifier,
+            selectedPartitions, tableSample, tableSnapshot, scanParams, 
incrementalRelation,
+            operativeSlots, virtualColumns, groupExpression, 
Optional.of(getLogicalProperties()),
+            Optional.of(cachedOutputs));
+    }
+
     /**
      * Set scan params for incremental read
      *


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

Reply via email to