neilconway commented on code in PR #20385:
URL: https://github.com/apache/datafusion/pull/20385#discussion_r2833632994


##########
datafusion/functions-nested/src/array_has.rs:
##########
@@ -476,6 +483,179 @@ fn array_has_any_inner(args: &[ArrayRef]) -> 
Result<ArrayRef> {
     array_has_all_and_any_inner(args, ComparisonType::Any)
 }
 
+/// Fast path for `array_has_any` when exactly one argument is a scalar.
+fn array_has_any_with_scalar(
+    columnar_arg: &ColumnarValue,
+    scalar_arg: &ScalarValue,
+) -> Result<ColumnarValue> {
+    if scalar_arg.is_null() {
+        return Ok(ColumnarValue::Scalar(ScalarValue::Boolean(None)));
+    }
+
+    // Convert the scalar to a 1-element ListArray, then extract the inner 
values
+    let scalar_array = scalar_arg.to_array_of_size(1)?;
+    let scalar_list: ArrayWrapper = scalar_array.as_ref().try_into()?;
+    let scalar_values = scalar_list.values();

Review Comment:
   `to_array_of_size` never returns a sliced array, but I guess it might in the 
future, will fix.



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