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

Function array_replace_all_inner

datafusion/functions-nested/src/replace.rs:455–474  ·  view source on GitHub ↗
(args: &[ArrayRef])

Source from the content-addressed store, hash-verified

453}
454
455fn array_replace_all_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
456 let [array, from, to] = take_function_args("array_replace_all", args)?;
457
458 // replace all occurrences (up to "i64::MAX")
459 let arr_n = vec![i64::MAX; array.len()];
460 match array.data_type() {
461 DataType::List(_) => {
462 let list_array = array.as_list::<i32>();
463 general_replace::<i32>(list_array, from, to, &arr_n)
464 }
465 DataType::LargeList(_) => {
466 let list_array = array.as_list::<i64>();
467 general_replace::<i64>(list_array, from, to, &arr_n)
468 }
469 DataType::Null => Ok(new_null_array(array.data_type(), 1)),
470 array_type => {
471 exec_err!("array_replace_all does not support type '{array_type}'.")
472 }
473 }
474}

Callers

nothing calls this directly

Calls 2

take_function_argsFunction · 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…