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



##########
File path: cpp/src/arrow/compute/kernels/scalar_compare.cc
##########
@@ -68,6 +72,50 @@ struct GreaterEqual {
   }
 };
 
+struct BetweenLessEqualLessEqual {
+  template <typename T, typename Arg0, typename Arg1, typename Arg2>
+  static constexpr T Call(KernelContext*, const Arg0& middle, const Arg1& left,
+                          const Arg2& right, Status*) {
+    static_assert(std::is_same<T, bool>::value && std::is_same<Arg0, 
Arg1>::value &&
+                      std::is_same<Arg1, Arg2>::value,
+                  "");
+    return (left <= middle) && (middle <= right);
+  }
+};
+
+struct BetweenLessThanLessEqual {
+  template <typename T, typename Arg0, typename Arg1, typename Arg2>
+  static constexpr T Call(KernelContext*, const Arg0& middle, const Arg1& left,
+                          const Arg2& right, Status*) {
+    static_assert(std::is_same<T, bool>::value && std::is_same<Arg0, 
Arg1>::value &&
+                      std::is_same<Arg1, Arg2>::value,
+                  "");
+    return (left < middle) && (middle <= right);
+  }
+};
+
+struct BetweenLessEqualLessThan {
+  template <typename T, typename Arg0, typename Arg1, typename Arg2>
+  static constexpr T Call(KernelContext*, const Arg0& middle, const Arg1& left,
+                          const Arg2& right, Status*) {
+    static_assert(std::is_same<T, bool>::value && std::is_same<Arg0, 
Arg1>::value &&
+                      std::is_same<Arg1, Arg2>::value,
+                  "");
+    return (left <= middle) && (middle < right);
+  }
+};
+
+struct BetweenLessThanLessThan {
+  template <typename T, typename Arg0, typename Arg1, typename Arg2>
+  static constexpr T Call(KernelContext*, const Arg0& middle, const Arg1& left,
+                          const Arg2& right, Status*) {
+    static_assert(std::is_same<T, bool>::value && std::is_same<Arg0, 
Arg1>::value &&
+                      std::is_same<Arg1, Arg2>::value,
+                  "");
+    return (left < middle) && (middle < right);
+  }
+};

Review comment:
       I don't think we want to keep the structure of the compare functions 
though. CompareOptions is going to be removed (ARROW-13378) and CompareFunction 
is really only there to make tests more convenient. I don't think we need to 
make between act like the compare functions, and I still agree with Eduardo 
that a structure like the round function makes more sense.




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