alamb commented on code in PR #8365:
URL: https://github.com/apache/arrow-rs/pull/8365#discussion_r2363897588
##########
parquet-variant-compute/src/variant_get.rs:
##########
@@ -87,20 +88,20 @@ pub(crate) fn follow_shredded_path_element<'a>(
return Ok(missing_path_step());
};
- let field = field
- .as_any()
- .downcast_ref::<ShreddedVariantFieldArray>()
- .ok_or_else(|| {
- // TODO: Should we blow up? Or just end the traversal and
let the normal
- // variant pathing code sort out the mess that it must
anyway be
- // prepared to handle?
- ArrowError::InvalidArgumentError(format!(
- "Expected a ShreddedVariantFieldArray, got {:?}
instead",
- field.data_type(),
- ))
- })?;
-
- Ok(ShreddedPathStep::Success(field.shredding_state()))
+ let struct_array = field.as_struct_opt().ok_or_else(|| {
+ // TODO: Should we blow up? Or just end the traversal and let
the normal
+ // variant pathing code sort out the mess that it must anyway
be
+ // prepared to handle?
+ ArrowError::InvalidArgumentError(format!(
+ "Expected Struct array while following path, got {}",
+ field.data_type(),
+ ))
+ })?;
+
+ let shredding_state =
+
ShreddedVariantFieldArray::shredding_state_from_struct_array(struct_array)?;
Review Comment:
This is a great idea. I did it in
https://github.com/apache/arrow-rs/pull/8392 (commit 4b1daab75f)
--
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]