-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[Variant] Add variant docs and examples #7661
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
|
FYI @mkarbo @superserious-dev @scovich and @PinkCrow007 |
# Which issue does this PR close? - Part of #6736 # Rationale for this change While making documentation / examples for working with `Variant` in #7661, I found it was somewhat awkward to make `Variant` values directly from the metadata and value. Specifically you have to ```rust let metadata = [0x01, 0x00, 0x00]; let value = [0x09, 0x48, 0x49]; // parse the header metadata let metadata = VariantMetadata::try_new(&metadata).unwrap(); // and only then can you make the Variant Variant::try_new(&metadata, &value).unwrap() ``` I would really like to be able to create `Variant `directly from `metadata` and `value` without having to make a `VariantMetadata` structure # What changes are included in this PR? This PR proposes a small change to the API so creating a Variant now looks like: ```rust let metadata = [0x01, 0x00, 0x00]; let value = [0x09, 0x48, 0x49]; // You can now make the Variant directly from the metadata and value Variant::try_new(&metadata, &value).unwrap() ``` # Are there any user-facing changes? Yes, the API for creating APIs is slightly different (and I think better)
|
I am quite pleased with how this looks now |
|
@scovich @PinkCrow007 or @mkarbo , might I trouble one of you for a review of this PR (no code, just docs)? |
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 tiny nits
| /// | ||
| /// When stored in Parquet files, Variant fields can also be *shredded*. Shredding | ||
| /// refers to extracting some elements of the variant into separate columns for | ||
| /// more efficient extraction/filter pushdown. The [Variant Shredding |
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.
Link?
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.

Which issue does this PR close?
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax.
Rationale for this change
Using the parquet APIs came up in #7644 (comment) so I wanted to help contribute some additional documentation / tests
What changes are included in this PR?
Add documentation and tests about
Variant, specifically some examples of how to createVariantvaluesAre there any user-facing changes?
More docs