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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathPlanCollector.java:
##########
@@ -125,9 +129,14 @@ public Void visitLogicalGenerate(LogicalGenerate<? extends 
Plan> generate, State
                             int colIndex = 
Integer.parseInt(colName.substring(StructLiteral.COL_PREFIX.length())) - 1;
                             CollectorContext argumentContext = new 
CollectorContext(context, false);
                             argumentContext.setType(accessPath.getType());
-                            if 
(function.child(colIndex).getDataType().isVariantType()) {
-                                argumentContext.getAccessPathBuilder()
-                                        .addSuffix(path.subList(2, 
path.size()));
+                            if 
(function.child(colIndex).getDataType().isVariantType()
+                                    && 
!isNestedGroupVariant(function.child(colIndex))) {
+                                // Every Variant argument determines the 
generated array shape, so
+                                // an output-field path must not narrow the 
input container.
+                                
exprCollector.collect(function.child(colIndex));

Review Comment:
   [P1] Preserve every ordinary Variant argument of multi-argument explode
   
   `colIndex` covers only the referenced output field, but every argument still 
contributes its container and array length. For example:
   
   ```text
   Project(g.col1['k'], v2['k'])
     Generate(explode(v1, v2) AS g)
       FileScan(v1, v2)
   ```
   
   For `SELECT x1['k'], v2['k'] FROM t LATERAL VIEW explode(v1, v2) e AS x1, 
x2`, this branch collects the whole `v1` but leaves `v2` at `[v2,k]`. A 
conforming shredded `v2` can have object field `k` in its schema while a row 
contains a root residual array `[1,2]`; its terminal `k.value` is all NULL. The 
new terminal-only guard then permits a partial `v2` and omits that array. 
`VExplodeV2TableFunction::process_init` still initializes both arguments, and 
`cast_variant_to_array(nullptr, ...)` calls `get_value_ref()`, which throws “A 
projected Parquet Variant can only serve its validated shredded leaves”. With 
`v1=[{"k":1}]`, this valid row should generate two results. The previous 
ancestor-residual check restored full `v2` for this case.
   
   Collect the whole container for every ordinary Variant argument 
independently of the referenced output paths, and cover distinct input columns 
where the unused exploded output's source is also read by a narrow path.



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