Gabriel39 commented on code in PR #66575:
URL: https://github.com/apache/doris/pull/66575#discussion_r3746568070


##########
be/src/format_v2/parquet/parquet_reader.cpp:
##########
@@ -72,104 +72,143 @@ const ParquetColumnSchema* schema_child_by_name(const 
ParquetColumnSchema& schem
     return child_it == schema.children.end() ? nullptr : child_it->get();
 }
 
-bool collect_variant_residual_leaf_ids(const ParquetColumnSchema& schema,
-                                       const format::LocalColumnIndex& 
projection,
-                                       std::vector<int>* residual_leaf_ids) {
+bool collect_variant_terminal_fallback_leaf_ids(const ParquetColumnSchema& 
schema,
+                                                const 
format::LocalColumnIndex& projection,
+                                                std::vector<int>* 
residual_leaf_ids) {
     DORIS_CHECK(residual_leaf_ids != nullptr);
     const auto* value = schema_child_by_name(schema, "value");
     const auto* typed_value = schema_child_by_name(schema, "typed_value");
-    if (value != nullptr && typed_value != nullptr) {
-        if (value->kind != ParquetColumnSchemaKind::PRIMITIVE || 
value->leaf_column_id < 0) {
+    if (value != nullptr && value->kind == ParquetColumnSchemaKind::PRIMITIVE 
&&
+        typed_value != nullptr) {
+        if (value->leaf_column_id < 0) {
             return false;
         }
+        const auto typed_projection_it =
+                std::ranges::find_if(projection.children, [&](const auto& 
child_projection) {
+                    return child_projection.local_id() == 
typed_value->local_id;
+                });
+        if (typed_projection_it == projection.children.end()) {
+            return false;
+        }
+        if (typed_value->kind != ParquetColumnSchemaKind::PRIMITIVE) {
+            return collect_variant_terminal_fallback_leaf_ids(*typed_value, 
*typed_projection_it,
+                                                              
residual_leaf_ids);
+        }
+        // Object residual keys are disjoint from shredded keys. Only the 
fallback paired with the

Review Comment:
   Fixed in a5c2fa09598. Variant generators now stop access-path propagation at 
the generator input container, so explode(v) requests all of v and 
explode(v[\"arr\"]) stops at v/arr. The FE tests cover direct, nested, 
filtered, multi-level, and alias-derived generator paths.



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