-
Notifications
You must be signed in to change notification settings - Fork 1k
[Variant] Simpler shredding state #8444
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
/// Create a new `ShreddingState` from the given `value` and `typed_value` fields | ||
/// | ||
/// Note you can create a `ShreddingState` from a &[`StructArray`] using | ||
/// `ShreddingState::try_from(&struct_array)`, for example: |
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.
ShreddingState
constructor became infallible some time ago, and it changed to impl From
instead of TryFrom
at the same time. But this example kept working because of a blanket impl TryFrom
in rust that leverages From
under the hood.
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.
/// | non-NULL | non-NULL | The value is present and is a partially shredded object | | ||
/// | ||
/// | ||
/// Applying the above rules to entire columns, we obtain the following: |
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 for preserving this information
Any reason not to merge? |
🚀 |
/// | ||
/// | value | typed_value | Meaning | | ||
/// |--------|-------------|---------| | ||
/// | -- | -- | **Missing**: The value is always missing; only valid for shredded object fields | |
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.
Thanks for this comment!
Which issue does this PR close?
Struct
#8336Rationale for this change
While working on #8438, I noticed that the enum variants of
ShreddingState
actually made the code (a lot) more complex than if I just referenced the (optional) value and typed_value columns directly. That made me wonder ifShreddingState
would be better as a simple two-field struct.What changes are included in this PR?
Change
ShreddingState
to a two-field struct and update the few call sites that noticed.While we're at it, improve the docs about how shredding works.
Are these changes tested?
Existing tests cover what is mostly an internal change
Are there any user-facing changes?
ShreddingState
is pub and changed from enum to struct.