(
args: Vec<ArrayRef>,
)
| 84 | } |
| 85 | |
| 86 | pub(crate) fn align_array_dimensions<O: OffsetSizeTrait>( |
| 87 | args: Vec<ArrayRef>, |
| 88 | ) -> Result<Vec<ArrayRef>> { |
| 89 | let args_ndim = args |
| 90 | .iter() |
| 91 | .map(|arg| datafusion_common::utils::list_ndims(arg.data_type())) |
| 92 | .collect::<Vec<_>>(); |
| 93 | let max_ndim = args_ndim.iter().max().unwrap_or(&0); |
| 94 | |
| 95 | // Align the dimensions of the arrays |
| 96 | let aligned_args: Result<Vec<ArrayRef>> = args |
| 97 | .into_iter() |
| 98 | .zip(args_ndim.iter()) |
| 99 | .map(|(array, ndim)| { |
| 100 | if ndim < max_ndim { |
| 101 | let mut aligned_array = Arc::clone(&array); |
| 102 | for _ in 0..(max_ndim - ndim) { |
| 103 | let data_type = aligned_array.data_type().to_owned(); |
| 104 | let array_lengths = vec![1; aligned_array.len()]; |
| 105 | let offsets = OffsetBuffer::<O>::from_lengths(array_lengths); |
| 106 | |
| 107 | aligned_array = Arc::new(GenericListArray::<O>::try_new( |
| 108 | Arc::new(Field::new_list_field(data_type, true)), |
| 109 | offsets, |
| 110 | aligned_array, |
| 111 | None, |
| 112 | )?) |
| 113 | } |
| 114 | Ok(aligned_array) |
| 115 | } else { |
| 116 | Ok(Arc::clone(&array)) |
| 117 | } |
| 118 | }) |
| 119 | .collect(); |
| 120 | |
| 121 | aligned_args |
| 122 | } |
| 123 | |
| 124 | /// Computes a BooleanArray indicating equality or inequality between elements in a list array and a specified element array. |
| 125 | /// |
nothing calls this directly
no test coverage detected
searching dependent graphs…