izveigor commented on code in PR #6872:
URL: https://github.com/apache/arrow-datafusion/pull/6872#discussion_r1256272497
##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -373,20 +373,84 @@ pub fn array_prepend(args: &[ArrayRef]) ->
Result<ArrayRef> {
Ok(res)
}
+fn compute_array_ndims(arg: u8, arr: ArrayRef) -> Result<u8> {
+ match arr.data_type() {
+ DataType::List(..) => {
+ let list_array = downcast_arg!(arr, ListArray);
+ compute_array_ndims(arg + 1, list_array.value(0))
+ }
+ DataType::Null
+ | DataType::Utf8
+ | DataType::LargeUtf8
+ | DataType::Boolean
+ | DataType::Float32
+ | DataType::Float64
+ | DataType::Int8
+ | DataType::Int16
+ | DataType::Int32
+ | DataType::Int64
+ | DataType::UInt8
+ | DataType::UInt16
+ | DataType::UInt32
+ | DataType::UInt64 => Ok(arg),
+ data_type => Err(DataFusionError::NotImplemented(format!(
+ "Array is not implemented for type '{data_type:?}'."
+ ))),
+ }
+}
+
+fn align_array_dimensions(args: Vec<ArrayRef>) -> Result<Vec<ArrayRef>> {
+ // Compute the number of dimensions for each array
+ let args_ndim: Result<Vec<u8>> = args
Review Comment:
```
let args_ndim = args.iter().map(|arr| compute_array_ndims(0,
arr.clone).max()?;
```
--
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]