-
Notifications
You must be signed in to change notification settings - Fork 839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent Dyn Scalar Kernels #2837
Comments
I think that one thing is after following _scalar_dyn arithmetic kernels such _dyn_primitive_scalar kernels will need type bound when calling. As the scalar is I think it is minor so just mention it here. |
Renaming the kernels sounds good to me 👍
Would it be better to simply not have the Here is where @matthewmturner and I cooked up the original API: #1074 which also gives some background on why we didn't go with the |
The issue isn't documentation, but that the kernels are inconsistent in their behaviour with respect to the non-scalar kernels, and the arithmetic scalar kenels. If I try to add an Further the encoding using
The key comment appears to be #1074 (comment). Is there any possibility I might be able to shift your feeling on this matter? Perhaps we could have a synchronous chat? Looking at DataFusion, |
If #1074 (comment) causes issues for the rest of the implementation, I don't feel strongly about it |
Alternative proposal in #2842 - FWIW this would allow removing a lot of scalar dispatch logic from DataFusion |
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
The
_dyn_scalar
comparison kernels accept a scalar value implementingnum::ToPrimitive
and then downcast the array, coercing the the scalar to the appropriate type. There are then furtherdyn_utf8_scalar
anddyn_binary_scalar
kernels to handle non-primitive arrays, these only handle arrays or dictionaries of arrays of the corresponding typeThe
_scalar_dyn
arithmetic kernels are instead explicitly typed onArrowNumericType
, which isArrowPrimitiveType
with some SIMD gubbins, and accept the correspondingT::Native
as a scalar argument. They then downcast to the expectedPrimitiveArray
or aDictionaryArray
containing the correspondingPrimitiveArray
Not only is the naming inconsistent, the primitive scalar comparison kernels will perform coercion of primitive scalars, whereas the arithmetic kernels and other comparison kernels will not.
Describe the solution you'd like
I think the approach of the arithmetic kernels is the least surprising, and as an added bonus is significantly simpler to implement.
I would therefore like to propose adding new
[eq | lt_eq | ...]_dyn_primitive_scalar
comparison kernels, and deprecating the old[eq | lt_eq | ...]_dyn_scalar
kernels, before removing them in a future release.Describe alternatives you've considered
Additional context
The current use of
ToPrimitive
will likely complicate adding comparison support for decimal array (#2637) as ToPrimitive doesn't have a to_i256 method.This may also help reduce compile times for the comparison kernels #2365 #1858
Thoughts @alamb @viirya
The text was updated successfully, but these errors were encountered: