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 f06836483e3 branch-4.0: [fix](fe) Preserve operative slots when deep 
copying logical relations #63315 (#63708)
f06836483e3 is described below

commit f06836483e351f9b488a47c72daaa4edb49d7d9b
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu May 28 10:42:06 2026 +0800

    branch-4.0: [fix](fe) Preserve operative slots when deep copying logical 
relations #63315 (#63708)
    
    Cherry-picked from #63315
    
    Co-authored-by: foxtail463 <[email protected]>
    Co-authored-by: yangtao555 <[email protected]>
---
 .../doris/nereids/trees/copier/LogicalPlanDeepCopier.java     |  2 +-
 .../doris/nereids/trees/copier/LogicalPlanDeepCopierTest.java | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/copier/LogicalPlanDeepCopier.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/copier/LogicalPlanDeepCopier.java
index 33e32fe92e7..ba88203f849 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/copier/LogicalPlanDeepCopier.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/copier/LogicalPlanDeepCopier.java
@@ -463,7 +463,7 @@ public class LogicalPlanDeepCopier extends 
DefaultPlanRewriter<DeepCopierContext
     private Plan updateOperativeSlots(LogicalCatalogRelation oldRelation, 
LogicalCatalogRelation newRelation) {
         List<Slot> oldOperativeSlots = oldRelation.getOperativeSlots();
         List<Slot> newOperativeSlots = new 
ArrayList<>(oldOperativeSlots.size());
-        int outputSize = oldOperativeSlots.size();
+        int outputSize = oldRelation.getOutput().size();
         for (Slot opSlot : oldOperativeSlots) {
             int idx;
             for (idx = 0; idx < outputSize; idx++) {
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/copier/LogicalPlanDeepCopierTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/copier/LogicalPlanDeepCopierTest.java
index 4ba8edfe34c..7389fd2b8a3 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/copier/LogicalPlanDeepCopierTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/copier/LogicalPlanDeepCopierTest.java
@@ -49,6 +49,17 @@ public class LogicalPlanDeepCopierTest {
         }
     }
 
+    @Test
+    public void testDeepCopyOlapScanWithNonFirstOperativeSlot() {
+        LogicalOlapScan relationPlan = PlanConstructor.newLogicalOlapScan(0, 
"a", 0);
+        relationPlan = (LogicalOlapScan) relationPlan.withOperativeSlots(
+                ImmutableList.of(relationPlan.getOutput().get(1)));
+        LogicalOlapScan aCopy =
+                (LogicalOlapScan) 
relationPlan.accept(LogicalPlanDeepCopier.INSTANCE, new DeepCopierContext());
+
+        Assertions.assertEquals(ImmutableList.of(aCopy.getOutput().get(1)), 
aCopy.getOperativeSlots());
+    }
+
     @Test
     public void testDeepCopyAggregateWithSourceRepeat() {
         LogicalOlapScan scan = PlanConstructor.newLogicalOlapScan(0, "t", 0);


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

Reply via email to