fix: preserve projection field metadata during physical planning - #23981
Conversation
| /// | ||
| /// Returns an error if the projection cannot be applied to the input plan, or if | ||
| /// `projected_schema` has a different number of fields than the projection. | ||
| pub fn try_new_with_schema_metadata<I, E>( |
There was a problem hiding this comment.
Could we add a focused unit test for try_new_with_schema_metadata? It would be helpful to assert the exact output schema and field metadata, while also confirming that the expression-derived name, type, and nullability remain unchanged. The planner regression test covers the aggregate failure, but a constructor-level test would document this API's metadata-only contract and test it independently of aggregate validation.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #23981 +/- ##
==========================================
+ Coverage 80.75% 80.89% +0.13%
==========================================
Files 1096 1102 +6
Lines 373582 376228 +2646
Branches 373582 376228 +2646
==========================================
+ Hits 301686 304341 +2655
+ Misses 53893 53774 -119
- Partials 18003 18113 +110 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Which issue does this PR close?
Rationale for this change
Logical projection aliases can attach field metadata, but physical projection planning derived its output schema only from the unwrapped physical expressions. This caused schema validation to reject
aggregates above such projections.
What changes are included in this PR?
ProjectionExec.Are these changes tested?
Yes. A focused physical planner regression test reproduces the original schema mismatch and passes with the fix. The relevant core and physical-plan unit suites, targeted all-targets/all-features
clippy, formatting, and diff checks also pass.
Are there any user-facing changes?
Projection field metadata is now preserved in physical plans. Two additive constructor methods support passing projection schema metadata across crate boundaries; no existing API is changed.