-
Notifications
You must be signed in to change notification settings - Fork 1k
[Variant] Add as_u* for Variant #8284
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
Conversation
@alamb Please help review this when you're free, thanks. |
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 @klion26 -- looks good to me
Would it be possible to add some tests for converting Decimal as well?
parquet-variant/src/variant.rs
Outdated
/// let v1 = Variant::from(123i64); | ||
/// assert_eq!(v1.as_u8(), Some(123u8)); | ||
/// | ||
/// // but not a variant that cant fit into the range |
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.
/// // but not a variant that cant fit into the range | |
/// // but not a variant that can't fit into the range |
parquet-variant/src/variant.rs
Outdated
/// let v1 = Variant::from(123i64); | ||
/// assert_eq!(v1.as_u16(), Some(123u16)); | ||
/// | ||
/// // but not a variant that cant fit into the range |
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.
/// // but not a variant that cant fit into the range | |
/// // but not a variant that can't fit into the range |
parquet-variant/src/variant.rs
Outdated
/// let v1 = Variant::from(123i64); | ||
/// assert_eq!(v1.as_u32(), Some(123u32)); | ||
/// | ||
/// // but not a variant that cant fit into the range |
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.
/// // but not a variant that cant fit into the range | |
/// // but not a variant that can't fit into the range |
@alamb thanks for the review, I've updated the code, please take another look. |
Thanks @klion26 -- looks great to me |
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! The doc tests are a nice way to exercise the code (dual purpose)
Which issue does this PR close?
Vairant::as_u*
#8283.Rationale for this change
Add the
Variant::as_u*
functions`Are these changes tested?
Added doc tests
Are there any user-facing changes?
No