MCPcopy Create free account
hub / github.com/apache/datafusion / get_list_values

Function get_list_values

datafusion/spark/src/function/map/utils.rs:48–58  ·  view source on GitHub ↗

Helper function to get [`values`](arrow::array::ListArray::values) from [`ListArray`](arrow::array::ListArray)/[`LargeListArray`](arrow::array::LargeListArray)/[`FixedSizeListArray`](arrow::array::FixedSizeListArray) [`NullArray`](arrow::array::NullArray) can be coerced to `ListType`([`Null`](DataType::Null)), so [`NullArray`](arrow::array::NullArray) is returned For all other types [`exec

(array: &ArrayRef)

Source from the content-addressed store, hash-verified

46/// [`NullArray`](arrow::array::NullArray) can be coerced to `ListType`([`Null`](DataType::Null)), so [`NullArray`](arrow::array::NullArray) is returned<br>
47/// For all other types [`exec_err`] is raised
48pub fn get_list_values(array: &ArrayRef) -> Result<&ArrayRef> {
49 match array.data_type() {
50 DataType::Null => Ok(array),
51 DataType::List(_) => Ok(array.as_list::<i32>().values()),
52 DataType::LargeList(_) => Ok(array.as_list::<i64>().values()),
53 DataType::FixedSizeList(..) => Ok(array.as_fixed_size_list().values()),
54 wrong_type => exec_err!(
55 "get_list_values expects List/LargeList/FixedSizeList/Null as argument, got {wrong_type:?}"
56 ),
57 }
58}
59
60/// Helper function to get [`offsets`](arrow::array::ListArray::offsets)
61/// from [`ListArray`](arrow::array::ListArray)/[`LargeListArray`](arrow::array::LargeListArray)/[`FixedSizeListArray`](arrow::array::FixedSizeListArray)<br>

Callers 2

map_from_arrays_innerFunction · 0.85
map_from_entries_innerFunction · 0.85

Calls 2

data_typeMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…