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

Function array_reverse_inner

datafusion/functions-nested/src/reverse.rs:117–144  ·  view source on GitHub ↗

array_reverse SQL function

(arg: &[ArrayRef])

Source from the content-addressed store, hash-verified

115
116/// array_reverse SQL function
117pub fn array_reverse_inner(arg: &[ArrayRef]) -> Result<ArrayRef> {
118 let [input_array] = take_function_args("array_reverse", arg)?;
119
120 match &input_array.data_type() {
121 List(field) => {
122 let array = as_list_array(input_array)?;
123 general_array_reverse::<i32>(array, field)
124 }
125 LargeList(field) => {
126 let array = as_large_list_array(input_array)?;
127 general_array_reverse::<i64>(array, field)
128 }
129 FixedSizeList(field, _) => {
130 let array = as_fixed_size_list_array(input_array)?;
131 fixed_size_array_reverse(array, field)
132 }
133 Null => Ok(Arc::clone(input_array)),
134 ListView(field) => {
135 let array = as_list_view_array(input_array)?;
136 list_view_reverse::<i32>(array, field)
137 }
138 LargeListView(field) => {
139 let array = as_large_list_view_array(input_array)?;
140 list_view_reverse::<i64>(array, field)
141 }
142 array_type => exec_err!("array_reverse does not support type '{array_type}'."),
143 }
144}
145
146fn general_array_reverse<O: OffsetSizeTrait>(
147 array: &GenericListArray<O>,

Callers 1

array_reverseFunction · 0.85

Calls 8

take_function_argsFunction · 0.85
as_list_arrayFunction · 0.85
as_large_list_arrayFunction · 0.85
as_fixed_size_list_arrayFunction · 0.85
fixed_size_array_reverseFunction · 0.85
as_list_view_arrayFunction · 0.85
as_large_list_view_arrayFunction · 0.85
data_typeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…