morrySnow opened a new pull request, #67803:
URL: https://github.com/apache/doris/pull/67803

   ### What problem does this PR solve?
   
   Problem Summary:
   
   When nested-column pruning was disabled, a multi-level VARIANT access could 
return different values from the regular and constant branches of a `UNION 
ALL`. For example, with `{"a":{"b":1},"b":{"a":2}}`, selecting `c['a']['b']` 
returned `1` from the table branch but `2` from the constant branch.
   
   The pruning context stores sub-paths in canonical root-to-leaf order, such 
as `[a, b]`. The UNION constant-expression rewrite and the project pushdown 
rewrite rebuilt nested `ElementAt` expressions by iterating those paths 
backwards, producing `c['b']['a']`.
   
   This change centralizes construction of nested `ElementAt` expressions and 
applies each canonical sub-path from root to leaf. It uses the same helper for 
UNION constant expressions and projected VARIANT expressions so extraction and 
reconstruction share one order contract.
   
   The regression test reproduces the UNION result mismatch with nested-column 
pruning disabled, covers the projected-expression path, and verifies the 
enabled-pruning control case.
   
   ### Release note
   
   Fix incorrect values for multi-level VARIANT sub-paths in UNION ALL constant 
branches.
   
   ### Check List (For Author)
   
   - Test:
     - Unit Test: `PruneNestedColumnTest` (62 tests)
     - Regression Test: `variant_p0/test_variant_sub_path_order`
     - Full FE build
   - Behavior changed: Yes. Multi-level VARIANT sub-paths now preserve SQL 
access order across rewritten branches.
   - Does this need documentation: No
   


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