Skip to content

Commit 6caf58f

Browse files
committed
return based on data_type in make_array
1 parent 05e365a commit 6caf58f

1 file changed

Lines changed: 4 additions & 20 deletions

File tree

datafusion/physical-expr/src/array_expressions.rs

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ use datafusion_common::cast::{
3333
as_generic_list_array, as_generic_string_array, as_int64_array, as_list_array,
3434
as_null_array, as_string_array,
3535
};
36-
use datafusion_common::utils::{
37-
array_into_large_list_array, array_into_list_array, list_ndims,
38-
};
36+
use datafusion_common::utils::{array_into_list_array, list_ndims};
3937
use datafusion_common::{
4038
exec_err, internal_err, not_impl_err, plan_err, DataFusionError, Result,
4139
};
@@ -360,28 +358,14 @@ pub fn make_array(arrays: &[ArrayRef]) -> Result<ArrayRef> {
360358
}
361359
}
362360

363-
let len = arrays.len();
364361
match data_type {
365362
// Either an empty array or all nulls:
366363
DataType::Null => {
367364
let array = new_null_array(&DataType::Null, arrays.len());
368-
if len <= i32::MAX as usize {
369-
Ok(Arc::new(array_into_list_array(array)))
370-
} else if len <= i64::MAX as usize {
371-
Ok(Arc::new(array_into_large_list_array(array)))
372-
} else {
373-
exec_err!("The number of elements {} in the array exceed the maximum number of elements supported by DataFusion",len)
374-
}
375-
}
376-
data_type => {
377-
if len <= i32::MAX as usize {
378-
array_array::<i32>(arrays, data_type)
379-
} else if len <= i64::MAX as usize {
380-
array_array::<i64>(arrays, data_type)
381-
} else {
382-
exec_err!("The number of elements {} in the array exceed the maximum number of elements supported by DataFusion",len)
383-
}
365+
Ok(Arc::new(array_into_list_array(array)))
384366
}
367+
DataType::LargeList(..) => array_array::<i64>(arrays, data_type),
368+
_ => array_array::<i32>(arrays, data_type),
385369
}
386370
}
387371

0 commit comments

Comments
 (0)