matthewmturner commented on a change in pull request #1074:
URL: https://github.com/apache/arrow-rs/pull/1074#discussion_r774753656
##########
File path: arrow/src/compute/kernels/comparison.rs
##########
@@ -898,6 +899,224 @@ pub fn gt_eq_utf8_scalar<OffsetSize:
StringOffsetSizeTrait>(
compare_op_scalar!(left, right, |a, b| a >= b)
}
+macro_rules! dyn_compare_scalar {
+ ($LEFT: expr, $RIGHT: expr, $OP: ident) => {{
+ let right: i128 = $RIGHT.try_into().map_err(|_| {
+ ArrowError::ComputeError(String::from("Can not convert scalar to
i128"))
+ })?;
+ match ($LEFT.data_type(), $RIGHT.get_arrow_type()) {
+ // (DataType::Boolean, DataType::Boolean) => {
+ // typed_cmp_scalar!($LEFT, $RIGHT, BooleanArray, $OP_BOOL)
+ // }
+ (DataType::Int8, DataType::Int8) => {
+ let right: i8 = right.try_into().map_err(|_| {
+ ArrowError::ComputeError(String::from(
+ "Can not convert scalar to i128",
+ ))
+ })?;
+ let left =
+ $LEFT.as_any().downcast_ref::<Int8Array>().ok_or_else(|| {
+ ArrowError::CastError(String::from("Left array cannot
be cast"))
+ })?;
Review comment:
I think these functions require an `Arc<dyn Array>` /`ArrayRef` which
would mean we need the end user to do that before passing the array to the
kernel or do you think its okay to add the `Arc` in the kernel?
--
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]