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

Function list_values

datafusion/common/src/utils/mod.rs:1073–1082  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1071/// sliced array too. Therefore, too reconstruct a list using it,
1072/// you must adjust the offsets using [`adjust_offsets_for_slice`]
1073pub 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
1084fn sliced_list_values<O: OffsetSizeTrait>(list: &GenericListArray<O>) -> ArrayRef {
1085 let values = list.values();

Callers 2

invoke_with_argsMethod · 0.85
extract_list_valuesFunction · 0.85

Calls 3

sliced_list_valuesFunction · 0.85
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…