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

Function array_distinct_inner

datafusion/functions-nested/src/set_ops.rs:301–315  ·  view source on GitHub ↗

array_distinct SQL function example: from list [1, 3, 2, 3, 1, 2, 4] to [1, 2, 3, 4]

(args: &[ArrayRef])

Source from the content-addressed store, hash-verified

299/// array_distinct SQL function
300/// example: from list [1, 3, 2, 3, 1, 2, 4] to [1, 2, 3, 4]
301fn array_distinct_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
302 let [array] = take_function_args("array_distinct", args)?;
303 match array.data_type() {
304 Null => Ok(Arc::clone(array)),
305 List(field) => {
306 let array = as_list_array(&array)?;
307 general_array_distinct(array, field)
308 }
309 LargeList(field) => {
310 let array = as_large_list_array(&array)?;
311 general_array_distinct(array, field)
312 }
313 arg_type => exec_err!("array_distinct does not support type {arg_type}"),
314 }
315}
316
317#[derive(Debug, PartialEq, Copy, Clone)]
318enum SetOp {

Callers

nothing calls this directly

Calls 5

take_function_argsFunction · 0.85
as_list_arrayFunction · 0.85
general_array_distinctFunction · 0.85
as_large_list_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…