Convert a columnar value into an Arrow [`ArrayRef`] with the specified number of rows. [`Self::Scalar`] is converted by repeating the same scalar multiple times which is not as efficient as handling the scalar directly. This validates that if this is [`Self::Array`], it has the expected length. See [`Self::values_to_arrays`] to convert multiple columnar values into arrays of the same length. # E
(self, num_rows: usize)
| 154 | /// Errors if `self` is a Scalar that fails to be converted into an array of size or |
| 155 | /// if the array length does not match the expected length |
| 156 | pub fn into_array_of_size(self, num_rows: usize) -> Result<ArrayRef> { |
| 157 | match self { |
| 158 | ColumnarValue::Array(array) => { |
| 159 | if array.len() == num_rows { |
| 160 | Ok(array) |
| 161 | } else { |
| 162 | internal_err!( |
| 163 | "Array length {} does not match expected length {}", |
| 164 | array.len(), |
| 165 | num_rows |
| 166 | ) |
| 167 | } |
| 168 | } |
| 169 | ColumnarValue::Scalar(scalar) => scalar.to_array_of_size(num_rows), |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | /// Convert any [`Self::Scalar`] into an Arrow [`ArrayRef`] with the specified |
| 174 | /// number of rows by repeating the same scalar multiple times, |