-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[Variant] Add negative tests for reading invalid primitive variant values #7779
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
standardize naming
parquet-variant/Cargo.toml
Outdated
| [dependencies] | ||
| arrow-schema = { workspace = true } | ||
| chrono = { workspace = true } | ||
| paste = { version = "1.0" } |
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.
Used for writing the decoder test macros. This is already a dependency in the parquet crate, so bringing it into parquet-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.
If it is only used in tests, perhaps we can move it to dev-dependencies
[dev-dependencies]
paste = { version = "1.0" }
parquet-variant/src/decoder.rs
Outdated
| use super::*; | ||
| use paste::paste; | ||
|
|
||
| mod integer { |
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.
Created macros and grouped similar tests together in order to reduce some of the boilerplate test code.
parquet-variant/src/decoder.rs
Outdated
|
|
||
| // Makes the code a bit more readable | ||
| pub(crate) const VARIANT_VALUE_HEADER_BYTES: usize = 1; | ||
| pub(crate) const DECIMAL_MAX_SCALE: u8 = 38; |
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.
According to the spec, all the decimal variants have a max scale of 38.
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 think this somewhat overlaps with @scovich 's PR here: [Variant] Add negative tests for reading invalid primitive variant values #7779
#7779 does not include any decoder tests though
I think we could potentially avoid checking the scale/precision for decimals in the decoder and let the higher level validation check them
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.
That makes sense. I removed the extra scale validation.
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 @superserious-dev -- I think this is a very nice improvement. I have some suggestions on how to improve the testing, but I don't think they are required
I suspect there will be some conflicts to resolve after I merge #7776 which I am about to do
parquet-variant/Cargo.toml
Outdated
| [dependencies] | ||
| arrow-schema = { workspace = true } | ||
| chrono = { workspace = true } | ||
| paste = { version = "1.0" } |
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.
If it is only used in tests, perhaps we can move it to dev-dependencies
[dev-dependencies]
paste = { version = "1.0" }
parquet-variant/src/decoder.rs
Outdated
|
|
||
| // Makes the code a bit more readable | ||
| pub(crate) const VARIANT_VALUE_HEADER_BYTES: usize = 1; | ||
| pub(crate) const DECIMAL_MAX_SCALE: u8 = 38; |
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 think this somewhat overlaps with @scovich 's PR here: [Variant] Add negative tests for reading invalid primitive variant values #7779
#7779 does not include any decoder tests though
I think we could potentially avoid checking the scale/precision for decimals in the decoder and let the higher level validation check them
|
Thanks again @superserious-dev |
Which issue does this PR close?
Rationale for this change
Follow-up from the previous PR that added decoders for primitive values.
What changes are included in this PR?