sdf-jkl commented on code in PR #8354:
URL: https://github.com/apache/arrow-rs/pull/8354#discussion_r2842862447
##########
parquet-variant-compute/src/variant_get.rs:
##########
@@ -96,15 +167,35 @@ pub(crate) fn follow_shredded_path_element<'a>(
))
})?;
- let state = BorrowedShreddingState::try_from(struct_array)?;
+ let state = ShreddingState::try_from(struct_array)?;
Ok(ShreddedPathStep::Success(state))
}
- VariantPathElement::Index { .. } => {
- // TODO: Support array indexing. Among other things, it will
require slicing not
- // only the array we have here, but also the corresponding
metadata and null masks.
- Err(ArrowError::NotYetImplemented(
- "Pathing into shredded variant array index".into(),
- ))
+ VariantPathElement::Index { index } => {
+ let state = if let Some(list_array) =
+ typed_value.as_any().downcast_ref::<GenericListArray<i32>>()
+ {
+ take_list_index_as_shredding_state(list_array, *index,
cast_options)?
+ } else if let Some(list_array) =
+ typed_value.as_any().downcast_ref::<GenericListArray<i64>>()
+ {
+ take_list_index_as_shredding_state(list_array, *index,
cast_options)?
+ } else {
+ // Downcast failure - if strict cast options are enabled, this
should be an error
+ if !cast_options.safe {
+ return Err(ArrowError::CastError(format!(
Review Comment:
I postponed adding match arms for other List-like types till we push #9457
--
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]