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)
| 204 | /// Errors if `self` is a Scalar that fails to be converted into an array of size or |
| 205 | /// if the array length does not match the expected length |
| 206 | pub fn to_array_of_size(&self, num_rows: usize) -> Result<ArrayRef> { |
| 207 | match self { |
| 208 | ColumnarValue::Array(array) => { |
| 209 | if array.len() == num_rows { |
| 210 | Ok(Arc::clone(array)) |
| 211 | } else { |
| 212 | internal_err!( |
| 213 | "Array length {} does not match expected length {}", |
| 214 | array.len(), |
| 215 | num_rows |
| 216 | ) |
| 217 | } |
| 218 | } |
| 219 | ColumnarValue::Scalar(scalar) => scalar.to_array_of_size(num_rows), |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | /// Null columnar values are implemented as a null array in order to pass batch |
| 224 | /// num_rows |
no test coverage detected