Conversation
|
The test error was caused by: the line here: impl_primitive_from_variant!(datatypes::Time64MicrosecondType, as_time_utc, |v| {
Some((v.num_seconds_from_midnight() * 1_000_000 + v.nanosecond() / 1_000) as i64)
});Multiplication happens before casting Fixed here: 718efbf |
|
@codephage2020 @scovich @klion26 please check when you are available. Thanks! |
codephage2020
left a comment
There was a problem hiding this comment.
LGTM. One small suggestion.
klion26
left a comment
There was a problem hiding this comment.
Thanks for the improvement. Overall looks great to me. I left some minor comments to be considered.
Another question is whether we need to support shred to LargeUtf8/LargeBinary, I can only find this comment, it seems is legal to support (it may not need to be included in the current pr even if we want to support it)
…t_get-clean-up
You're right. I found the mention in arrow-rs/parquet-variant-compute/src/shred_variant.rs Lines 1147 to 1166 in d2e2cda I'd add support for these types for |
|
I filed a ticket for the |
|
Moved some tests to be close to each other, might split to a separate PR to make this easier to review. cc1869f Mostly code movement and removed some comments. |
| arrow::array::BooleanArray::from(vec![Some(true), None, None, Some(false)]) | ||
| }); | ||
|
|
||
| partially_shredded_variant_array_gen!(partially_shredded_utf8_variant_array, || { |
There was a problem hiding this comment.
IIUC, this will generate the data that(the second is invalid) typed_value contains hello, n/a, and world(Variant::from("n/a") in the macro will also be shredded into typed_value) , there is no item located in value, maybe we can improve this case to satisfy that there are some items in typed_value and some in value
klion26
left a comment
There was a problem hiding this comment.
LGTM, thanks for the improvement
| } | ||
|
|
||
| #[test] | ||
| // TODO(#9518): Drop this once variant_get tests build shredded fixtures via shred_variant. |
There was a problem hiding this comment.
I realized the tests we use in variant_get.rs create a perfectly shredded array, so it's not doing full multi type validation.
We should keep the shred_variant.rs tests as is.
| }); | ||
| impl_primitive_from_variant!(datatypes::Time64MicrosecondType, as_time_utc, |v| { | ||
| Some((v.num_seconds_from_midnight() * 1_000_000 + v.nanosecond() / 1_000) as i64) | ||
| Some(v.num_seconds_from_midnight() as i64 * 1_000_000 + v.nanosecond() as i64 / 1_000) |
| assert_eq!(result.value(0), Variant::from("hello")); | ||
| assert!(!result.is_valid(1)); | ||
| assert_eq!(result.value(2), Variant::from("n/a")); | ||
| assert_eq!(result.value(2), Variant::from(42i32)); |
There was a problem hiding this comment.
(Maybe we can change what is created in partially_shredded_utf8_variant_array?)
There was a problem hiding this comment.
The output of this function should be a partially shredded VariantArray. If we reuse the same fall back value - "n/a", the Utf8 VariantArray would end up perfectly shredded.
Mentioned here: #9518 (comment)
| assert_eq!(result.value(0), Variant::from("hello")); | ||
| assert!(!result.is_valid(1)); | ||
| assert_eq!(result.value(2), Variant::from("n/a")); | ||
| assert_eq!(result.value(2), Variant::from(42i32)); |
There was a problem hiding this comment.
(Maybe we can change what is created in partially_shredded_utf8_variant_array?)
Which issue does this PR close?
variant_gettests clean up #9517.Rationale for this change
check issue
What changes are included in this PR?
variant_shredin test macrosVariantArray::from_partsinstead of usingStructArrayBuilderAre these changes tested?
yes, changes pass same tests
Are there any user-facing changes?
no