jayzhan211 commented on code in PR #9656:
URL: https://github.com/apache/arrow-datafusion/pull/9656#discussion_r1527982956
##########
datafusion/functions-array/src/utils.rs:
##########
@@ -108,6 +111,107 @@ pub(crate) fn align_array_dimensions<O: OffsetSizeTrait>(
aligned_args
}
+/// 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
+///
+/// ```text
+/// 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]
+/// )
+/// ```
+pub(crate) fn compare_element_to_list(
Review Comment:
There are three duplicated code including this one, can you remove other two?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]