eldenmoon commented on code in PR #39022:
URL: https://github.com/apache/doris/pull/39022#discussion_r1721185333


##########
be/src/olap/rowset/segment_v2/segment.cpp:
##########
@@ -599,6 +604,44 @@ Status Segment::new_column_iterator_with_path(const 
TabletColumn& tablet_column,
                type == ReaderType::READER_FULL_COMPACTION || type == 
ReaderType::READER_CHECKSUM;
     };
 
+    auto new_default_iter = [&]() {
+        if (tablet_column.is_nested_subcolumn() &&
+            type_to_read_flat_leaves(opt->io_ctx.reader_type)) {
+            // We find node that represents the same Nested type as path.
+            const auto* parent = 
_sub_column_tree.find_best_match(*tablet_column.path_info_ptr());
+            VLOG_DEBUG << "find with path " << 
tablet_column.path_info_ptr()->get_path()
+                       << " parent " << (parent ? parent->path.get_path() : 
"nullptr") << ", type "
+                       << ", parent is nested " << (parent ? 
parent->is_nested() : false) << ", "
+                       << 
TabletColumn::get_string_by_field_type(tablet_column.type());
+            // find it's common parent with nested part
+            // why not use parent->path->has_nested_part? because parent may 
not be a leaf node
+            // none leaf node may not contain path info
+            // Example:
+            // {"payload" : {"commits" : [{"issue" : {"id" : 123, "email" : 
"a@b"}}]}}
+            // nested node path          : payload.commits(NESTED)
+            // tablet_column path_info   : payload.commits.issue.id(SCALAR
+            // parent path node          : payload.commits.issue(TUPLE)
+            // leaf path_info            : payload.commits.issue.email(SCALAR)
+            if (parent && SubcolumnColumnReaders::find_parent(
+                                  parent, [](const auto& node) { return 
node.is_nested(); })) {
+                /// Find any leaf of Nested subcolumn.
+                const auto* leaf = SubcolumnColumnReaders::find_leaf(

Review Comment:
   done



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to