sdf-jkl commented on code in PR #9663:
URL: https://github.com/apache/arrow-rs/pull/9663#discussion_r3082655476
##########
parquet-variant-compute/src/shred_variant.rs:
##########
@@ -321,12 +328,19 @@ impl<'a> VariantToShreddedArrayVariantRowBuilder<'a> {
// If the variant is not an array, typed_value must be null.
// If the variant is an array, value must be null.
match variant {
- Variant::List(list) => {
+ Variant::List(ref list) => {
self.nulls.append_non_null();
- self.value_builder.append_null();
- self.typed_value_builder
- .append_value(&Variant::List(list))?;
- Ok(true)
+
+ // With `safe` cast option set to false, appending list of
wrong size to
+ // `typed_value_builder` of type `FixedSizeList` will result
in an error. In such a
+ // case, the provided list should be appended to the
`value_builder.
Review Comment:
It differs physically on the Arrow side, but once we write it to Parquet
it'd be same as other `ListLikeArray`s. But this leads to further discussion on
adding FixedSizeList support for VariantArray as well as implementing other
types, currently not supported in spec.
We're keeping `value` because we consider this a cast from Variant to
`FixedSizeList`. The extra len check is there because there is no
`Variant::FixedSizeList` enum to match to. If len is incorrect we consider the
cast failed and proceed following the safe cast option as if typed_value is
Null.
##########
parquet-variant-compute/src/shred_variant.rs:
##########
@@ -321,12 +328,19 @@ impl<'a> VariantToShreddedArrayVariantRowBuilder<'a> {
// If the variant is not an array, typed_value must be null.
// If the variant is an array, value must be null.
match variant {
- Variant::List(list) => {
+ Variant::List(ref list) => {
self.nulls.append_non_null();
- self.value_builder.append_null();
- self.typed_value_builder
- .append_value(&Variant::List(list))?;
- Ok(true)
+
+ // With `safe` cast option set to false, appending list of
wrong size to
+ // `typed_value_builder` of type `FixedSizeList` will result
in an error. In such a
+ // case, the provided list should be appended to the
`value_builder.
Review Comment:
It differs physically on the Arrow side, but once we write it to Parquet
it'd be same as other `ListLikeArray`s. But this leads to further discussion on
adding FixedSizeList support for VariantArray as well as implementing other
types, currently not supported in spec.
We're keeping `value` because we consider this a cast from Variant to
`FixedSizeList`. The extra len check is there because there is no
`Variant::FixedSizeList` enum to match to. If len is incorrect we consider the
cast failed and proceed following the safe cast option as if `typed_value` is
Null.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]