shepmaster commented on pull request #984:
URL: https://github.com/apache/arrow-rs/pull/984#issuecomment-992777187
> avoid having to add type annotations to the call of `eq_dict_scalar`?
You can likely infer the first type (`eq_dict_scalar::<_, UInt8Type>(&array,
123)`) because the type is directly related to the `left` argument:
```rust
pub fn eq_dict_scalar<T, K>(
left: &DictionaryArray<K>,
right: T::Native,
) -> Result<BooleanArray>
where
T: ArrowNumericType,
K: ArrowNumericType,
```
The problem with the `right` argument is that there's potentially an
infinite number of concrete `T` types that could have a matching associated
type `Native`:
```rust
impl ArrowNumericType for OneThing {
type Native = u8;
}
impl ArrowNumericType for SomeOtherThing {
type Native = u8;
}
```
I won't claim to have read the code thoroughly, but I'm not yet
understanding why there are two generics here. Could you change the function to
have only one?
```rust
pub fn eq_dict_scalar<K>(
left: &DictionaryArray<K>,
right: K::Native,
) -> Result<BooleanArray>
where
K: ArrowNumericType,
```
--
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]