-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Follow-up Improvements to Avro union handling #8385
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
Follow-up Improvements to Avro union handling #8385
Conversation
…a constraints, and improve error reporting. Add tests for missing union branch names, named type signatures, and codec validation. Optimize union variant resolution logic and simplify schema traversal for complex types.
|
@scovich Here's the follow-up that incorporates your recommendations. Let me know what you think. |
scovich
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, couple nits
| } | ||
| } | ||
| } | ||
| let (reader_index, promotion) = direct.or(promo).ok_or_else(|| { |
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.
Can delete direct now (L1363 above)?
arrow-avro/src/codec.rs
Outdated
| fn mk_primitive<'a>(pt: PrimitiveType) -> Schema<'a> { | ||
| Schema::TypeName(TypeName::Primitive(pt)) |
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.
Interesting... 'a doesn't "attach" to any input arg? Not quite sure how that works in rust...
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.
Does this work, out of curiosity?
| fn mk_primitive<'a>(pt: PrimitiveType) -> Schema<'a> { | |
| Schema::TypeName(TypeName::Primitive(pt)) | |
| fn mk_primitive(pt: PrimitiveType) -> Schema<'_> { | |
| Schema::TypeName(TypeName::Primitive(pt)) |
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.
Nope... might be a case where 'static actually makes sense?
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.
I hit these same issues. Dealing with mk_primitive is initially what led me to make the others static.
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.
I'll just change mk_primitive back to being static.
Co-authored-by: Ryan Johnson <[email protected]>
@scovich Ty for the quick review. I just pushed up some improvements based on your comments. Let me know what you think. |
scovich
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.
Nice!
alamb
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.
Thank you @jecsand838 and @scovich
Which issue does this PR close?
This work continues arrow-avro schema resolution support and aligns behavior with the Avro spec.
Rationale for this change
@scovich left a really solid review on #8348 that wasn't completed until after the PR was merged in. This PR is for addressing the suggestions and improving the code.
What changes are included in this PR?
codec.rsschema.rsincluding spec compliant named type errors.Are these changes tested?
codec.rsand all existing tests are passing without changes.schema.rsto cover the spec compliant named type changes.Are there any user-facing changes?
N/A