kosiew commented on code in PR #22980:
URL: https://github.com/apache/datafusion/pull/22980#discussion_r3433166833
##########
datafusion/common/src/nested_struct.rs:
##########
@@ -208,15 +231,7 @@ fn cast_list_column<O: arrow::array::OffsetSizeTrait>(
target_inner_field: &FieldRef,
cast_options: &CastOptions,
) -> Result<ArrayRef> {
- let source_list = source_col
- .as_any()
- .downcast_ref::<GenericListArray<O>>()
- .ok_or_else(|| {
- crate::error::DataFusionError::Plan(format!(
- "Expected list array but got {}",
- source_col.data_type()
- ))
- })?;
+ let source_list = downcast_array!(source_col, GenericListArray<O>, "list
array")?;
Review Comment:
You're right. Arrow arrays already expose typed accessors (`as_list::<O>()`,
`as_list_view::<O>()`, `as_fixed_size_list()`), so the local `downcast_array!`
helper adds avoidable code and inconsistency. I’ll replace the helper usages
with the existing downcast methods and remove the helper.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]