fix(proto): destructure JSON source and sink serde hooks - #24945
fix(proto): destructure JSON source and sink serde hooks#24945buraksenn wants to merge 2 commits into
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 #24945 +/- ##
==========================================
+ Coverage 81.52% 81.58% +0.06%
==========================================
Files 1123 1123
Lines 405970 410945 +4975
Branches 405970 410945 +4975
==========================================
+ Hits 330983 335287 +4304
- Misses 55626 55912 +286
- Partials 19361 19746 +385 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
kumarUjjawal
left a comment
There was a problem hiding this comment.
Thank you @buraksenn for working on this. Just had one comment then we should we good to go.
| @@ -583,6 +583,8 @@ pub struct EmptyMessage {} | |||
| pub struct JsonWriterOptions { | |||
| #[prost(enumeration = "CompressionTypeVariant", tag = "1")] | |||
| pub compression: i32, | |||
| #[prost(uint32, optional, tag = "2")] | |||
| pub compression_level: ::core::option::Option<u32>, | |||
There was a problem hiding this comment.
The optional protobuf field preserves binary compatibility, but adding this public Rust field breaks existing literals such as JsonWriterOptions { compression: 0 }. These now need compression_level: None or ..Default::default(). Could we correct “There are no breaking API changes” in the PR description and add a short upgrade note?
Which issue does this PR close?
Rationale for this change
Protobuf hooks that access fields individually can silently omit newly added
state. For JSON sinks, this caused an explicitly configured compression level
to revert to the default after a physical-plan protobuf roundtrip.
Exhaustive destructuring makes newly added source, sink, and wire fields compile
errors until their serialization behavior is explicitly considered.
What changes are included in this PR?
JsonSourceandJsonSinkin their encoders.JsonSinkhook exhaustive while centralizing field mapping inits public
TryFrom<&JsonSink>conversion.compression_levelto theJsonWriterOptionsprotobuf message andpreserve it in both conversion directions.
file configuration, and sort order directly.
The protobuf change is additive and backward compatible.
Are these changes tested?
Yes. The focused JSON source and sink roundtrip tests pass:
cargo test -p datafusion-proto --test proto_integration roundtrip_jsonAre there any user-facing changes?
Physical plans containing JSON sinks now preserve an explicitly configured
compression level across protobuf roundtrips. Older payloads without the new
field continue to decode with no explicit compression level.
There are no breaking API changes.