-
Notifications
You must be signed in to change notification settings - Fork 353
refactor(rust): unify tuple struct and named struct protocol, and make schema evolution happy #3092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
chaokunyang
merged 1 commit into
apache:main
from
ariesdevil:feat/add-tuple-struct-support
Dec 26, 2025
Merged
refactor(rust): unify tuple struct and named struct protocol, and make schema evolution happy #3092
chaokunyang
merged 1 commit into
apache:main
from
ariesdevil:feat/add-tuple-struct-support
Dec 26, 2025
Conversation
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
chaokunyang
reviewed
Dec 25, 2025
chaokunyang
reviewed
Dec 25, 2025
chaokunyang
reviewed
Dec 25, 2025
chaokunyang
reviewed
Dec 25, 2025
chaokunyang
reviewed
Dec 25, 2025
chaokunyang
reviewed
Dec 25, 2025
chaokunyang
reviewed
Dec 25, 2025
chaokunyang
reviewed
Dec 25, 2025
chaokunyang
reviewed
Dec 25, 2025
chaokunyang
reviewed
Dec 25, 2025
f1e8c08 to
6a0b4aa
Compare
…e schema evolution happy
6a0b4aa to
1a47cc3
Compare
Contributor
Author
|
@chaokunyang Fixed, PTAL again. |
chaokunyang
approved these changes
Dec 26, 2025
Collaborator
chaokunyang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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.
Why?
This PR fixes a schema evolution issue with tuple structs.
Previously, tuple struct fields were sorted by type (same as named structs), which caused schema evolution to break when adding fields of different types.
For example, evolving
struct Point(f64, u8)tostruct Point(f64, u8, f64)would cause fields to be incorrectly matched during deserialization because the newf64field would be sorted beforeu8.What does this PR do?
Introduce SortedField struct: A helper struct that preserves the original field index alongside the field reference. This allows us to correctly track field positions regardless of serialization order.
Preserve tuple struct field order: For tuple structs, fields are no longer sorted by type. Instead, they maintain their original definition order ("0", "1", "2", ...). This ensures that field names consistently map to their positions, enabling proper schema evolution.
Unify protocol for tuple and named structs: Both tuple structs and named structs now use the same underlying protocol (field name based matching), but with different field name strategies:
Add schema evolution tests: Comprehensive tests for tuple struct schema evolution, including:
i64,u8,f64)Related issues
Does this PR introduce any user-facing change?
[ ] Does this PR introduce any public API change?
[x] Does this PR introduce any binary protocol compatibility change?
Note: Yes, but since tuple struct support is just supported, I think no one(except me) is using this feature now : )
Benchmark