alamb commented on pull request #984:
URL: https://github.com/apache/arrow-rs/pull/984#issuecomment-992819072


   > IMO we need a dyn Scalar and a cmp_scalar(array: &dyn Array, scalar: &dyn 
Scalar) -> BooleanArray that dispatches to specific implementations based on 
the array's datatype. We then use cmp_scalar(dict.values().as_ref(), scalar) 
and clone the indices. Inspiration for trait Scalar here: 
https://github.com/jorgecarleitao/arrow2/tree/main/src/scalar . I hope it helps.
   
   @jorgecarleitao  -- Indeed, this is an excellent idea. 🤔 
   
   Following the existing pattern in the comparison kernels,  we will likely 
end up with several kernels such as 
   ```
   eq_dyn_lit(left: &dyn Array, right: &dyn Array)
   eq_utf8_dyn_lit(left: &dyn Array, right: impl AsRef<str>)
   eq_bool_dyn_lit(left: &dyn Array, right: bool)
   ```
   
   Which might be nice as the user's rust code could leave the scalar `right` 
strongly typed, but it would still have to call the correct kernel.  It also 
has the upside that it wouldn't require an owned `String` for an Utf8 constant, 
but we can probably make a `dyn Scalar` work like that too with some finagling
   
   @jorgecarleitao  when you say "inspiration" do you mean it would be ok to 
incorporate https://github.com/jorgecarleitao/arrow2/tree/main/src/scalar into 
arrow-rs? I have somewhat lost track of what was needed IP clearance wise.  
Maybe since arrow2 is apache licensed, it is fine?


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