lyne7-sc commented on code in PR #22390:
URL: https://github.com/apache/datafusion/pull/22390#discussion_r3293923565


##########
datafusion/functions-nested/src/remove.rs:
##########
@@ -357,6 +381,47 @@ fn array_remove_internal(
     }
 }
 
+/// Dispatches scalar-needle array removal by list offset type.
+///
+/// `needle` must be a length-1 array containing the scalar element to remove.
+fn array_remove_dispatch_scalar(
+    array: &ArrayRef,
+    needle: &ArrayRef,
+    arr_n: &[i64],
+) -> Result<ArrayRef> {
+    match array.data_type() {
+        DataType::List(_) => {
+            let list_array = array.as_list::<i32>();
+            general_remove_with_scalar::<i32>(list_array, needle, arr_n)
+        }
+        DataType::LargeList(_) => {
+            let list_array = array.as_list::<i64>();
+            general_remove_with_scalar::<i64>(list_array, needle, arr_n)
+        }
+        array_type => exec_err!(
+            "array_remove/array_remove_n/array_remove_all does not support 
type '{array_type}'."
+        ),
+    }
+}
+
+/// Removes elements matching a scalar needle from a list array.
+///
+/// Uses a bulk `distinct` comparison for non-null, non-nested scalar elements,
+/// falling back to the per-row `general_remove` path for null or nested types.
+fn remove_with_scalar_needle(

Review Comment:
   fixed, hoisted the scalar check into `invoke_with_args` directly



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to