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

Function make_array_inner

datafusion/functions-nested/src/make_array.rs:132–149  ·  view source on GitHub ↗

`make_array_inner` is the implementation of the `make_array` function. Constructs an array using the input `data` as `ArrayRef`. Returns a reference-counted `Array` instance result.

(arrays: &[ArrayRef])

Source from the content-addressed store, hash-verified

130/// Constructs an array using the input `data` as `ArrayRef`.
131/// Returns a reference-counted `Array` instance result.
132pub(crate) fn make_array_inner(arrays: &[ArrayRef]) -> Result<ArrayRef> {
133 let data_type = arrays.iter().find_map(|arg| {
134 let arg_type = arg.data_type();
135 (!arg_type.is_null()).then_some(arg_type)
136 });
137
138 let data_type = data_type.unwrap_or(&Null);
139 if data_type.is_null() {
140 // Either an empty array or all nulls:
141 let length = arrays.iter().map(|a| a.len()).sum();
142 let array = new_null_array(&Null, length);
143 Ok(Arc::new(
144 SingleRowListArrayBuilder::new(array).build_list_array(),
145 ))
146 } else {
147 array_array::<i32>(arrays, data_type.clone(), Field::LIST_FIELD_DEFAULT_NAME)
148 }
149}
150
151/// Convert one or more [`ArrayRef`] of the same type into a
152/// `ListArray` or 'LargeListArray' depending on the offset size.

Callers 2

array_append_innerFunction · 0.70
array_prepend_innerFunction · 0.70

Calls 9

newFunction · 0.85
sumMethod · 0.80
build_list_arrayMethod · 0.80
iterMethod · 0.45
data_typeMethod · 0.45
is_nullMethod · 0.45
mapMethod · 0.45
lenMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…