fix(proto): preserve AggregateExec schema and reversed state - #24207
Merged
Conversation
|
Thank you for opening this pull request! Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch). Details |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #24207 +/- ##
==========================================
- Coverage 80.99% 80.98% -0.01%
==========================================
Files 1106 1106
Lines 383352 383395 +43
Branches 383352 383395 +43
==========================================
+ Hits 310488 310496 +8
- Misses 54544 54573 +29
- Partials 18320 18326 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jayzhan211
approved these changes
Aug 10, 2026
…egate-schema # Conflicts: # datafusion/proto/tests/cases/roundtrip_physical_plan.rs
…egate-schema # Conflicts: # datafusion/proto/tests/cases/roundtrip_physical_plan.rs
kosiew
pushed a commit
to kosiew/datafusion
that referenced
this pull request
Aug 12, 2026
…24207) ## Which issue does this PR close? - Closes apache#24202. ## Rationale for this change Physical-plan deserialization rebuilt `AggregateExec` output schemas from decoded aggregate expression names. `OptimizeAggregateOrder` can reverse aggregate expressions while preserving the original schema, causing protobuf round trips to change output field names and lose the expression's reversed state. ## What changes are included in this PR? - Serialize and restore the preserved `AggregateExec` output schema. - Serialize and restore `AggregateFunctionExpr::is_reversed`. - Fall back to schema reconstruction for older payloads without an output schema. - Regenerate the prost and pbjson models. - Add a byte-level regression test covering optimizer reversal and backward compatibility. ## Are these changes tested? Yes: - `cargo test -p datafusion-proto --test proto_integration roundtrip_aggregate_preserves_optimizer_schema_and_reversed_state` - `cargo fmt --all` - `cargo clippy --all-targets --all-features -- -D warnings` - `./dev/rust_lint.sh` ## Are there any user-facing changes? Physical-plan protobuf round trips now preserve aggregate output field names and reversed state. The protobuf wire format remains backward compatible; generated Rust model structs gain new fields.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
AggregateExecphysical-plan serde rebuilds the output schema, losing optimizer-preserved field names (andis_reversed) #24202.Rationale for this change
Physical-plan deserialization rebuilt
AggregateExecoutput schemas from decoded aggregate expression names.OptimizeAggregateOrdercan reverse aggregate expressions while preserving the original schema, causing protobuf round trips to change output field names and lose the expression's reversed state.What changes are included in this PR?
AggregateExecoutput schema.AggregateFunctionExpr::is_reversed.Are these changes tested?
Yes:
cargo test -p datafusion-proto --test proto_integration roundtrip_aggregate_preserves_optimizer_schema_and_reversed_statecargo fmt --allcargo clippy --all-targets --all-features -- -D warnings./dev/rust_lint.shAre there any user-facing changes?
Physical-plan protobuf round trips now preserve aggregate output field names and reversed state. The protobuf wire format remains backward compatible; generated Rust model structs gain new fields.