bkmgit commented on a change in pull request #11882:
URL: https://github.com/apache/arrow/pull/11882#discussion_r793732155



##########
File path: cpp/src/arrow/compute/kernels/scalar_compare.cc
##########
@@ -746,6 +805,199 @@ std::shared_ptr<ScalarFunction> 
MakeScalarMinMax(std::string name,
   return func;
 }
 
+template <template <BetweenOptions::Inclusive> class Op>
+Status MakeBetweenArrayExec(Type::type type_id, KernelContext* ctx,
+                            const ExecBatch& batch, Datum* out) {
+  using BetweenState = OptionsWrapper<BetweenOptions>;
+  const auto& state = static_cast<const BetweenState&>(*ctx->state());
+  if (type_id == Type::FIXED_SIZE_BINARY) {
+    switch (state.options.inclusive) {
+      case BetweenOptions::Inclusive::BOTH:
+        return ScalarTernaryEqualTypes<BooleanType, FixedSizeBinaryType,
+                                       
Op<BetweenOptions::Inclusive::BOTH>>::Exec(ctx,
+                                                                               
   batch,
+                                                                               
   out);
+      case BetweenOptions::Inclusive::LEFT:
+        return ScalarTernaryEqualTypes<BooleanType, FixedSizeBinaryType,
+                                       
Op<BetweenOptions::Inclusive::LEFT>>::Exec(ctx,
+                                                                               
   batch,
+                                                                               
   out);
+      case BetweenOptions::Inclusive::RIGHT:
+        return ScalarTernaryEqualTypes<BooleanType, FixedSizeBinaryType,
+                                       
Op<BetweenOptions::Inclusive::RIGHT>>::Exec(ctx,
+                                                                               
    batch,
+                                                                               
    out);
+      case BetweenOptions::Inclusive::NEITHER:
+        return ScalarTernaryEqualTypes<
+            BooleanType, FixedSizeBinaryType,
+            Op<BetweenOptions::Inclusive::NEITHER>>::Exec(ctx, batch, out);
+      default:
+        return Status::NotImplemented("between inclusiveness not implemented: 
",
+                                      state.options.ToString());
+    }
+  } else if (type_id == Type::DECIMAL128 || type_id == Type::DECIMAL256) {

Review comment:
       Will test, nice helper function.




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