ivan-kiselev opened a new pull request, #27947:
URL: https://github.com/apache/datafusion/pull/27947

   ## Which issue does this PR close?
   
   Closes #27946.
   
   ## Rationale for this change
   
   Leaf projection splitting can change the argument name observed by 
`arrow_field` from `value` to `__datafusion_leaf_0`. The same query returns 
different names with one and four partitions.
   
   ## What changes are included in this PR?
   
   Preserve extracted expressions' field names and reference them by index. 
Duplicate names remain distinct, including two struct fields and a passthrough 
column all named `value`. Leaf pushdown still reaches the scan. This adds no 
runtime expression wrapper and does not special-case `arrow_field`.
   
   This fix applies independently to main. #27925 and #27867 refactor the same 
code and will need integration; they are not included here.
   
   ## What is the testing strategy for this PR?
   
   The partition-comparison regression fails on unmodified main and passes with 
this fix. Collision tests check names, asymmetric numeric results, repeated 
references, and the exact scan projection. The existing adversarial lambda test 
retains a parameter name matching the extracted field.
   
   <details><summary>Local checks and benchmark</summary>
   
   - Nine related SQLLogicTest files pass.
   - Eight projection-pushdown unit tests pass.
   - Formatting and physical-optimizer Clippy with all targets/features and `-D 
warnings` pass.
   - Full workspace extended tests and workspace-wide Clippy were not run.
   
   A standalone optimized Rust binary measures only 
`try_split_leaf_projection`, with setup and correctness assertions outside the 
timer. Each case has 12 samples per version, 10,000 calls per sample, in 
baseline/candidate/candidate/baseline order. No file IO occurs.
   
   | Case | Main median | Fix median | Main range | Fix range |
   | --- | ---: | ---: | ---: | ---: |
   | One leaf | 33.882 µs | 32.820 µs | 33.233–36.162 µs | 32.363–38.861 µs |
   | Two leaves with colliding names | 50.615 µs | 48.099 µs | 48.222–54.674 µs 
| 46.231–54.105 µs |
   | No leaf, unchanged path | 49.6 ns | 50.7 ns | 48.5–51.7 ns | 49.6–55.1 ns |
   
   Ranges overlap. No material slowdown was observed; these measurements do not 
establish a speedup.
   
   </details>
   
   ## Are there any user-facing changes?
   
   Field-aware functions retain their argument names across the split. 
`EXPLAIN` shows original field names instead of synthetic leaf aliases. No 
public API changes.
   
   AI assistance: Amp helped implement and verify this change under the 
author's direction.
   


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