alamb opened a new issue, #4781: URL: https://github.com/apache/arrow-rs/issues/4781
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.** There is code like this in IOx that compare a value to `0` https://github.com/influxdata/influxdb_iox/blob/2a71fcbc76a695b1129895932746084a0a258bab/iox_query_influxql/src/window/non_negative.rs#L59-L60 This uses the now deprecated [`ly_dyn_scalar`](https://docs.rs/arrow/latest/arrow/compute/kernels/comparison/fn.lt_dyn_scalar.html) kernel I would like to update to use the non deprecated kernel `lt`: https://docs.rs/arrow/latest/arrow/compute/kernels/cmp/fn.lt.html However, to do so requires a "Datum" and thus I need some way to create a typed `Datum` for zero **Describe the solution you'd like** I don't really have a strong opinion, I just want something that will work reasonably for this usecase. **Describe alternatives you've considered** I found that arrow crate uses a function and [`Scalar`](https://docs.rs/arrow-array/46.0.0/arrow_array/struct.Scalar.html) to do this: https://docs.rs/arrow-ord/46.0.0/src/arrow_ord/comparison.rs.html#36-221 however the `Scalar` appears to be strongly typed which makes it hard to use with a dynamically typed kernel that takes `&dyn Datum` (aka is "type erased") without changing all callsites. Here is one possibility to perhaps expose the code that Arrow uses internally: ```rust /// A dynamic Datum that wraps an array and represents a single value #[derive(Debug, Clone)] pub struct ScalarDatum { arr: ArrayRef, } impl ScalarDatum { /// Create a [`ScalarDatum`] of type `d` that represents the primtive scalar value `scalar` fn try_new_primitive<T: num::ToPrimitive + std::fmt::Debug>( d: &DataType, scalar: T, ) -> Result<Self, ArrowError> { Ok(Self { arr: make_primitive_scalar_array(d, scalar)?, }) } } impl Datum for ScalarDatum { ... } ``` **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]
