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


##########
fe/fe-core/src/test/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslatorTest.java:
##########
@@ -102,9 +102,12 @@ public void testOlapPrune() throws Exception {
         List<String> qualifier = new ArrayList<>();
         qualifier.add("test");
         List<Slot> t1Output = new ArrayList<>();
-        SlotReference col1 = new SlotReference("col1", IntegerType.INSTANCE);
-        SlotReference col2 = new SlotReference("col2", IntegerType.INSTANCE);
-        SlotReference col3 = new SlotReference("col2", IntegerType.INSTANCE);
+        SlotReference col1 = 
SlotReference.fromColumn(StatementScopeIdGenerator.newExprId(),
+                t1, t1.getBaseSchema().get(0), qualifier);
+        SlotReference col2 = 
SlotReference.fromColumn(StatementScopeIdGenerator.newExprId(),
+                t1, t1.getBaseSchema().get(1), qualifier);
+        SlotReference col3 = 
SlotReference.fromColumn(StatementScopeIdGenerator.newExprId(),
+                t1, t1.getBaseSchema().get(1), qualifier);

Review Comment:
   This makes `col3` another slot for the same storage column as `col2`. In 
this fixture the column unique id is still 
`Column.COLUMN_UNIQUE_ID_INIT_VALUE`, so `computeStorageAlignedScanSlots()` 
falls back to the column name and the later `col3` overwrites `col2` as the 
`"name"` storage key slot. The scan tuple becomes `col1, col3, col2`; project 
pruning requires `col1` and `col2`, then `preserveExtraStorageKeySlots()` keeps 
`col3` as an extra key, so the assertion below still expecting two scan tuple 
slots should fail. Please give `col3` a distinct storage column or update the 
expected slot count to match the preserved key behavior.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java:
##########
@@ -2851,17 +2937,26 @@ public PlanFragment 
visitPhysicalLazyMaterializeTVFScan(PhysicalLazyMaterializeT
     @Override
     public PlanFragment 
visitPhysicalLazyMaterializeOlapScan(PhysicalLazyMaterializeOlapScan lazyScan,
             PlanTranslatorContext context) {
-        PlanFragment planFragment = 
computePhysicalOlapScan(lazyScan.getScan(), context);
+        PlanFragment planFragment = 
computePhysicalOlapScan(lazyScan.getScan(), context, false);
         OlapScanNode olapScanNode = (OlapScanNode) planFragment.getPlanRoot();
         // set lazy materialized context
         olapScanNode.setIsTopnLazyMaterialize(true);
         
olapScanNode.setGlobalRowIdColumn(lazyScan.getRowId().getOriginalColumn().get());
         Set<SlotId> scanIds = 
lazyScan.getOutput().stream().map(NamedExpression::getExprId)
                 
.map(context::findSlotRef).filter(Objects::nonNull).map(SlotRef::getSlotId)
                 .collect(Collectors.toSet());
+        preserveExtraStorageKeySlots(olapScanNode, scanIds);
 
         olapScanNode.getTupleDesc().getSlots().removeIf(slot -> 
!scanIds.contains(slot.getId()));

Review Comment:
   Creating this projection tuple before `translateRuntimeFilter(lazyScan, 
...)` rewrites the `ExprId -> SlotRef` mapping for lazy scan output slots to 
the projection tuple. The call below then uses those projection slot ids for 
both join runtime-filter targets and `TopnFilterContext.translateTarget()`, but 
BE initializes scan-side filters against the scan tuple: RF conjuncts are 
prepared with `p.row_descriptor()`, and TopN filter setup builds 
`_slot_id_to_slot_desc` from `_output_tuple_desc`, which `OlapScanOperatorX` 
sets to `olap_scan_node.tuple_id`. When an extra storage key is preserved and 
this projection is present, dynamic filters targeting a lazy-scan output slot 
can reference slot ids that are not in the scan tuple. Please translate the 
lazy scan filter targets before generating the projection tuple, or preserve 
the original scan-tuple SlotRefs for filter target binding.



-- 
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