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.
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
Simplify Variant shredding and refactor for clarity #461
base: master
Are you sure you want to change the base?
Simplify Variant shredding and refactor for clarity #461
Changes from 14 commits
d94f159
b91b9c4
73d4213
e1d2b74
6f13efb
ab126d0
d4afb1a
3462b46
012eb3c
ce706e0
5cdd682
2858477
4f5611d
413139a
9c283bc
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
@chenhao-db @cashmand Hi, I noticed that currently Spark's Variant writes the value first and then the metadata. which is the opposite of shredding. Have we considered making adjustments to this?
spark's variant
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.
Hi @Zouxxyy, in the Spark shredding PRs I've been working on, I put metadata first. I didn't see much benefit to changing the order in the existing non-shredded code, but I don't feel too strongly about it either way. The spec is pretty clear that readers should identify the appropriate columns based on field names, not field order, and I think things could become quite fragile if they did rely on field order.
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, but future users or developers may find it strange if the actual implementation differs from the specs. I think it's better to adhere to the specs as long as it doesn’t affect performance, before the official release of spark 4.0. If you don’t mind, I can work on this and raise a PR to spark, WDYT
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.
Okay, I think it's fine if you want to make a PR with the change.
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.
Oh, I checked again, and it seems that
new VariantVal(byte[] value, byte[] metadata)
is already used everywhere in spark, this change comes at a significant cost. @cashmand @rdblue , do you think the inconsistency here with the specs will have a big impact in the future?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 agree that the discrepancy is a bit unfortunate. Later in the shredding doc it says
The Parquet columns used to store variant metadata and values must be accessed by name, not by position
; maybe we should put it up front here.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.
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.
it might be worth noting that relying on the json values here might be lossy for some numbers (this is implied but people still ask questions ...)
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 guess the other alternative here is a hex encoded string which will always be bigger, base64 seems reasonable just want to call this out in case people have preferences.