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


##########
be/src/storage/segment/column_reader.cpp:
##########
@@ -110,6 +110,43 @@ void 
remove_current_level_meta_access_paths(TColumnAccessPaths& paths) {
     paths.erase(removed.begin(), removed.end());
 }
 
+Status read_or_fill_map_item_column(ColumnIterator* iterator, bool 
seek_to_start,
+                                    ordinal_t start_ordinal, size_t item_count,
+                                    MutableColumnPtr& dst) {
+    if (item_count == 0) {
+        return Status::OK();
+    }
+
+    if (iterator->need_to_read()) {
+        if (seek_to_start) {
+            RETURN_IF_ERROR(iterator->seek_to_ordinal(start_ordinal));
+        }
+        size_t num_read = item_count;
+        bool has_null = false;
+        RETURN_IF_ERROR(iterator->next_batch(&num_read, dst, &has_null));
+        DCHECK_EQ(num_read, item_count);
+        return Status::OK();
+    }
+
+    if (iterator->read_requirement() == ColumnIterator::ReadRequirement::SKIP) 
{
+        dst->insert_many_defaults(item_count);

Review Comment:
   With a map-level metadata predicate this `SKIP` branch can append the 
skipped side twice. For example, with nested pruning enabled, `SELECT 
map_keys(m) FROM t WHERE map_size(m) > 0` reaches BE as a map iterator that is 
`PREDICATE`, with the key child `LAZY_OUTPUT` and the value child `SKIP` 
(`map_size` emits an `OFFSET` predicate path, while `map_keys` emits a `KEYS` 
output path). The predicate-phase `next_batch()` reads the map offsets and this 
line fills default values for every map item. After filtering, 
`_read_lazy_pruned_columns()` calls `read_by_rowids()` on the same `ColumnMap` 
in `LAZY` phase; `need_to_read_meta_columns()` is false, but the skipped value 
child still hits this branch and appends another `item_count` defaults. The key 
side clears its placeholder and reads the selected keys, so the key/value child 
sizes no longer match each other or the offsets. Please distinguish the 
already-filled predicate-phase case from the whole-map-placeholder case, or 
only add the mis
 sing default elements during lazy recovery.
   



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