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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java:
##########
@@ -2978,6 +2981,8 @@ public PlanFragment 
visitPhysicalLazyMaterializeOlapScan(PhysicalLazyMaterialize
                 
.map(context::findSlotRef).filter(Objects::nonNull).map(SlotRef::getSlotId)
                 .collect(Collectors.toSet());
 
+        olapScanNode.updateRequiredSlots(context, scanIds);
+        preserveMergeSequenceSlots(olapScanNode, scanIds);

Review Comment:
   [P1] Preserve the full storage dependency set for lazy scans
   
   This second pruning pass bypasses the normal calls to 
preserveStorageSemanticSlots() and preserveExtraStorageKeySlots(). For the new 
test query, k1/k2 are lazy, so the scan descriptor keeps v1/sequence/rowid but 
drops the key prefix; BE then builds a ReadSchema with zero key columns and can 
merge distinct MOR keys as equal. Lazy snapshot/binlog scans similarly lose 
commit-TSO or TSO/op/before slots and fail initialization. Apply the same two 
preservation steps used by updateScanSlotsMaterialization before removing tuple 
slots.



##########
be/src/exec/scan/olap_scanner.cpp:
##########
@@ -769,29 +649,27 @@ Status OlapScanner::_init_return_columns() {
                     {unique_id, slot->predicate_access_paths()});
         }
 
-        if ((slot->type()->get_primitive_type() == PrimitiveType::TYPE_STRUCT 
||
-             slot->type()->get_primitive_type() == PrimitiveType::TYPE_MAP ||
-             slot->type()->get_primitive_type() == PrimitiveType::TYPE_ARRAY) 
&&
-            !slot->all_access_paths().empty()) {
-            tablet_schema->add_pruned_columns_data_type(column.unique_id(), 
slot->type());
-        }
-
-        _return_columns.push_back(index);
-        if (slot->is_nullable() && 
!tablet_schema->column(index).is_nullable()) {
-            _tablet_columns_convert_to_null_set.emplace(index);
-        } else if (!slot->is_nullable() && 
tablet_schema->column(index).is_nullable()) {
+        read_columns.push_back(tablet_schema->columns()[index]);
+        expected_types.push_back(slot->get_data_type_ptr());
+        if (!slot->is_nullable() && 
tablet_schema->column(index).is_nullable()) {
             return Status::Error<ErrorCode::INVALID_SCHEMA>(
                     "slot(id: {}, name: {})'s nullable does not match "
                     "column(tablet id: {}, index: {}, name: {}) ",
                     slot->id(), slot->col_name(), tablet_schema->table_id(), 
index,
                     tablet_schema->column(index).name());
         }
+        ++ordinal;
     }
 
-    if (_return_columns.empty()) {
+    if (read_columns.empty()) {
         return Status::InternalError("failed to build storage scanner, no 
materialized slot!");
     }
 
+    // The FE physical scan tuple is the read-path schema. It already includes

Review Comment:
   [P1] Keep a fallback for plans from older FEs
   
   This assumes every accepted FE plan already carries the new hidden 
dependencies, but the PR removes the BE-side expansion that older FEs rely on 
and adds no thrift/version handshake. The immediately prior FE emits the same 
be_exec_version=11, so its ordinary plans can reach this BE without 
sequence/map, commit-TSO, or row-binlog helper slots; the BE then silently 
chooses the wrong MOR winner or fails _init_tso_predicates/init_sequence_map. 
Retain legacy dependency expansion (with ordinal remapping), or add an explicit 
plan capability marker before treating the tuple as authoritative.



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