perf: reuse column normalization context across expressions - #25010
goutamadwant wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #25010 +/- ##
========================================
Coverage 81.69% 81.70%
========================================
Files 1127 1127
Lines 415471 415743 +272
Branches 415471 415743 +272
========================================
+ Hits 339424 339672 +248
+ Misses 56108 56107 -1
- Partials 19939 19964 +25 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
kosiew
left a comment
There was a problem hiding this comment.
Thanks for working on this. The lazy reusable normalization context looks like a nice improvement, and I like the added correctness tests and benchmark coverage.
I left one non-blocking benchmark suggestion below.
| .map(|i| Field::new(format!("c{i}"), DataType::Int32, false)) | ||
| .collect::<Vec<_>>(), | ||
| ); | ||
| let input = table_scan(Some("t"), &schema, None) |
There was a problem hiding this comment.
Nice to see benchmark coverage added here. The unqualified case already exercises the cached using_columns() traversal, but this plan does not include any JOIN ... USING nodes. It could be useful to add a wide JOIN ... USING input with unqualified projected expressions as well. That would measure the populated USING-column path directly and help protect that performance improvement going forward. Non-blocking.
Which issue does this PR close?
Rationale for this change
Column normalization repeatedly collects fallback schemas and traverses the input plan for USING columns. Wide expression lists and projections repeat that work for the same immutable plan.
What changes are included in this PR?
What is the testing strategy for this PR?
normalize_batch_schema_precedence,normalize_batch_using_join, andnormalize_batch_skips_unused_plan_contextto cover schema precedence, USING joins, ambiguity/error order, sort options, and lazy handling of qualified columns and literals.release-nonltoruns, constructing a 2,000-column unqualified projection falls from about 100 ms to 35 ms. This measures projection construction, not full protobuf decoding; small controls remain noisy.cargo bench -p datafusion-expr --bench normalize_columns --profile release-nonlto.dev/rust_lint.shalso passes, including strict workspace documentation checks.Are there any user-facing changes?
No public API or name-resolution behavior changes are intended. Normalization reuses plan context instead of collecting it for each column; existing schema lookup costs remain.