general_replace

Function general_replace 

Source
fn general_replace<O: OffsetSizeTrait>(
    list_array: &GenericListArray<O>,
    from_array: &ArrayRef,
    to_array: &ArrayRef,
    arr_n: Vec<i64>,
) -> Result<ArrayRef>
Expand description

For each element of list_array[i], replaces up to arr_n[i] occurrences of from_array[i], to_array[i].

The type of each element in list_array must be the same as the type of from_array and to_array. This function also handles nested arrays ([ListArray] of [ListArray]s)

For example, when called to replace a list array (where each element is a list of int32s, the second and third argument are int32 arrays, and the fourth argument is the number of occurrences to replace

general_replace(
  [1, 2, 3, 2], 2, 10, 1    ==> [1, 10, 3, 2]   (only the first 2 is replaced)
  [4, 5, 6, 5], 5, 20, 2    ==> [4, 20, 6, 20]  (both 5s are replaced)
)