datafusion icon indicating copy to clipboard operation
datafusion copied to clipboard

Support ANY operator

Open ovr opened this issue 3 years ago • 2 comments

Hello!

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

// similar to array contains
SELECT 1 = ANY(ARRAY[1,2,3,4])

// negative of array contains
SELECT 1 <> ANY(ARRAY[1,2,3,4])

// Same story for <, <=, >, >=

Thanks

ovr avatar May 16 '22 16:05 ovr

The = case has been implemented by #11849

Still pending work for the other cases (<, <=, etc.)

Jefffrey avatar Sep 20 '25 07:09 Jefffrey

Some pointers.

Planner code here, need to wire in support for operators other than =:

https://github.com/apache/datafusion/blob/2a08013af3ccf703bee202c959b40bb0d35bdea1/datafusion/functions-nested/src/planner.rs#L124-L136

Implementation in here:

https://github.com/apache/datafusion/blob/2a08013af3ccf703bee202c959b40bb0d35bdea1/datafusion/functions-nested/src/array_has.rs

  • Need to consider how to work it into the existing code and try not to duplicate for all operators if possible

Add SLT tests here:

https://github.com/apache/datafusion/blob/2a08013af3ccf703bee202c959b40bb0d35bdea1/datafusion/sqllogictest/test_files/array.slt

Jefffrey avatar Dec 10 '25 13:12 Jefffrey