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


   > @alamb ive started updating to your proposed approach but now when testing 
i get an error that a type annotation is needed for type parameter T. Im still 
playing around with it but ran out of time for today. Does that mean that the 
scalar needs to be casted to an ArrowPrimitiveType that is then used here:
   
   @matthewmturner -- I was able to make your branch compile using this change, 
but that seems quite non-ideal
   
   
   ```diff
   diff --git a/arrow/src/compute/kernels/comparison.rs 
b/arrow/src/compute/kernels/comparison.rs
   index f98e15d549..59d960220d 100644
   --- a/arrow/src/compute/kernels/comparison.rs
   +++ b/arrow/src/compute/kernels/comparison.rs
   @@ -2135,7 +2135,7 @@ mod tests {
            builder.append_null().unwrap();
            builder.append(223).unwrap();
            let array = builder.finish();
   -        let a_eq = eq_dict_scalar(&array, 123).unwrap();
   +        let a_eq = eq_dict_scalar::<UInt8Type, UInt8Type>(&array, 
123).unwrap();
            assert_eq!(
                a_eq,
                BooleanArray::from(vec![Some(true), None, Some(false)])
   ```
   
   I had been hoping something like this would work
   
   ```rust
           let a_eq = eq_dict_scalar(&array, 123u8).unwrap();
   ```
   
   (as in ensure that the 123 was typed as a u8)
   
   But the compiler still says it needs type annotations.
   
   So while the direct usability of `eq_dict_scalar` might be pretty low, I 
think it could then be used to implement `eq_dyn_scalar` (which I know I keep 
going on about)
   
   @tustvold  or @carols10cents  do you have any ideas how we might avoid 
having to add type annotations to the call of `eq_dict_scalar`?
   
   


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