compare_element_to_list

Function compare_element_to_list 

Source
pub(crate) fn compare_element_to_list(
    list_array_row: &dyn Array,
    element_array: &dyn Array,
    row_index: usize,
    eq: bool,
) -> Result<BooleanArray>
Expand description

Computes a BooleanArray indicating equality or inequality between elements in a list array and a specified element array.

§Arguments

  • list_array_row - A reference to a trait object implementing the Arrow Array trait. It represents the list array for which the equality or inequality will be compared.

  • element_array - A reference to a trait object implementing the Arrow Array trait. It represents the array with which each element in the list_array_row will be compared.

  • row_index - The index of the row in the element_array and list_array to use for the comparison.

  • eq - A boolean flag. If true, the function computes equality; if false, it computes inequality.

§Returns

Returns a Result<BooleanArray> representing the comparison results. The result may contain an error if there are issues with the computation.

§Example

compare_element_to_list(
    [1, 2, 3], [1, 2, 3], 0, true => [true, false, false]
    [1, 2, 3, 3, 2, 1], [1, 2, 3], 1, true => [false, true, false, false, true, false]

    [[1, 2, 3], [2, 3, 4], [3, 4, 5]], [[1, 2, 3], [2, 3, 4], [3, 4, 5]], 0, true => [true, false, false]
    [[1, 2, 3], [2, 3, 4], [2, 3, 4]], [[1, 2, 3], [2, 3, 4], [3, 4, 5]], 1, false => [true, false, false]
)