alamb opened a new issue, #1987:
URL: https://github.com/apache/arrow-rs/issues/1987

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   DataFusion (and likely other libraries) often wants to implement its own 
fast comparison functions 
   
   For example, comparing the contents of an array element by element to form 
an output `BooleanArray`
   
https://github.com/apache/arrow-datafusion/blob/7617d78809d4ff5bde31142e0744c70024e40635/datafusion/physical-expr/src/expressions/in_list.rs#L50
   
   
   the `arity::unary` is close to what I want: 
https://docs.rs/arrow/17.0.0/arrow/compute/kernels/arity/index.html but it can 
not produce a `BooleanArray` (because` BooleanArray` is not a `PrimitiveArray`)
   
   ```rust
   fn in_list_primitive<T: ArrowPrimitiveType>(
       array: &PrimitiveArray<T>,
       values: &[<T as ArrowPrimitiveType>::Native],
   ) -> Result<BooleanArray> {
       Ok(arity::unary(array, |x| values.contains(&x)))
   }
   ```
   
   **Describe the solution you'd like**
   I would like a function such as `unary_cmp` that I could call like:
   
   ```rust
   
   fn in_list_primitive<T: ArrowPrimitiveType>(
       array: &PrimitiveArray<T>,
       values: &[<T as ArrowPrimitiveType>::Native],
   ) -> Result<BooleanArray> {
       Ok(arity::unary_cmp(array, |x| values.contains(&x)))
   }
   
   ```
   
   There is a proposed implementation: 
https://github.com/apache/arrow-datafusion/pull/2826
   
   **Describe alternatives you've considered**
   
   **Additional context**
   Add any other context or screenshots about the feature request here.
   


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

Reply via email to