AdamGS commented on code in PR #9610:
URL: https://github.com/apache/arrow-rs/pull/9610#discussion_r3074737957
##########
parquet-variant-compute/src/variant_array.rs:
##########
@@ -375,7 +392,20 @@ impl VariantArray {
}
// Otherwise fall back to value, if available
(_, Some(value)) if value.is_valid(index) => {
- Ok(Variant::new(self.metadata.value(index),
value.value(index)))
+ let metadata =
+ binary_array_value(self.metadata.as_ref(),
index).ok_or_else(|| {
+ ArrowError::InvalidArgumentError(format!(
+ "metadata field must be a binary-like array,
instead got {}",
+ self.metadata.data_type(),
+ ))
+ })?;
+ let value = binary_array_value(value.as_ref(),
index).ok_or_else(|| {
+ ArrowError::InvalidArgumentError(format!(
+ "value field must be a binary-like array, instead got
{}",
+ value.data_type(),
+ ))
+ })?;
+ Ok(Variant::new(metadata, value))
Review Comment:
will add it, seems useful here, can return error and just be unwraped in
tests.
--
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]