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



##########
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:
       Ok. Even with UTF-8, sorting and comparison is not trivial, but a 
FunctionOption for that makes sense. This can be implemented later. 
   
   @kou @pitrou At present having four separate between functions seems 
reasonable. Will add Python bindings. Ideally, this could end up in 7.0.0 - 
then can request feedback from users and either keep the current structure for 
Between and Compare or use correctly implemented FunctionOptions for both 
Between and Compare, rather than having a wrapper - this would end up in 8.0.0.




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