Returns the inner values of a list, or an error otherwise For [`ListArray`] and [`LargeListArray`], if it's sliced, it returns a sliced array too. Therefore, too reconstruct a list using it, you must adjust the offsets using [`adjust_offsets_for_slice`]
(array: &dyn Array)
| 1071 | /// sliced array too. Therefore, too reconstruct a list using it, |
| 1072 | /// you must adjust the offsets using [`adjust_offsets_for_slice`] |
| 1073 | pub fn list_values(array: &dyn Array) -> Result<ArrayRef> { |
| 1074 | match array.data_type() { |
| 1075 | DataType::List(_) => Ok(sliced_list_values(array.as_list::<i32>())), |
| 1076 | DataType::LargeList(_) => Ok(sliced_list_values(array.as_list::<i64>())), |
| 1077 | DataType::FixedSizeList(_, _) => { |
| 1078 | Ok(Arc::clone(array.as_fixed_size_list().values())) |
| 1079 | } |
| 1080 | other => _exec_err!("expected list, got {other}"), |
| 1081 | } |
| 1082 | } |
| 1083 | |
| 1084 | fn sliced_list_values<O: OffsetSizeTrait>(list: &GenericListArray<O>) -> ArrayRef { |
| 1085 | let values = list.values(); |
no test coverage detected
searching dependent graphs…