github-actions[bot] commented on code in PR #65759:
URL: https://github.com/apache/doris/pull/65759#discussion_r3601621059


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalLazyMaterialize.java:
##########
@@ -180,7 +180,7 @@ public PhysicalLazyMaterialize(CHILD_TYPE child,
                 }
                 outputBuilder.add(outputSlot);
                 lazyColumnForRel.add(originalColumn);
-                
lazyBaseColumnIdxForRel.add(relationTable.getBaseColumnIdxByName(lazySlot.getName()));
+                
lazyBaseColumnIdxForRel.add(relationTable.getBaseColumnIdxByName(originalColumn.getName()));

Review Comment:
   [P1] Handle repeated aliases of one physical lazy column
   
   ```text
   Project(n1, n2)
     TopN(order by id)
       Project(name AS n1, name AS n2, id)
         HiveScan(id, name)
   ```
   
   The aliases have distinct ExprIds, so this loop appends the same 
`originalColumn` twice and sends `column_descs_lists = [[name, name]]` with 
indices `[[1, 1]]`. Thrift derives both slot names from the physical `Column`. 
In the phase-two positional ORC reader, `slot_map` consequently has one `name` 
entry; the first index erases it and the second dereferences the null inserted 
by `slot_map["name"]` (`be/src/format/table/hive_reader.cpp:64-83`). Parquet 
has the same sequence at lines 252-272. Thus this valid query can crash even 
after the single-alias fix. Please deduplicate fetches by relation/base 
column/access path and fan the value out to both output locations, or preserve 
unique transport identities, and add an executed duplicate-alias ORC/Parquet 
regression.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to