bkmgit commented on a change in pull request #11882:
URL: https://github.com/apache/arrow/pull/11882#discussion_r789005846
##########
File path: cpp/src/arrow/compute/kernels/scalar_compare_test.cc
##########
@@ -1865,5 +1867,683 @@ TEST(TestMaxElementWiseMinElementWise, CommonTemporal) {
ResultWith(ScalarFromJSON(date64(), "86400000")));
}
+template <typename ArrowType>
+static void ValidateBetween(BetweenOptions options, const Datum& val, const
Datum& lhs,
+ const Datum& rhs, const Datum& expected) {
+ ASSERT_OK_AND_ASSIGN(Datum result, Between(val, lhs, rhs, options, nullptr));
+ AssertArraysEqual(*expected.make_array(), *result.make_array(),
+ /*verbose=*/true);
+}
+
+template <typename ArrowType>
+void ValidateBetween(BetweenOptions options, const Datum& val, const Datum&
lhs,
+ const Datum& rhs) {
+ CompareOperator lhs_val;
+ CompareOperator val_rhs;
+ BetweenOptions::Inclusive include_endpoints = options.inclusive;
+
+ if (include_endpoints == BetweenOptions::Inclusive::NEITHER) {
+ lhs_val = LESS;
+ val_rhs = LESS;
+ } else if (include_endpoints == BetweenOptions::Inclusive::LEFT) {
+ lhs_val = LESS_EQUAL;
+ val_rhs = LESS;
+ } else if (include_endpoints == BetweenOptions::Inclusive::RIGHT) {
+ lhs_val = LESS;
+ val_rhs = LESS_EQUAL;
+ } else {
+ lhs_val = LESS_EQUAL;
+ val_rhs = LESS_EQUAL;
+ }
+
+ ASSERT_OK_AND_ASSIGN(Datum resultl,
+ CallFunction(CompareOperatorToFunctionName(lhs_val),
{lhs, val}));
+ ASSERT_OK_AND_ASSIGN(Datum resultr,
+ CallFunction(CompareOperatorToFunctionName(val_rhs),
{val, rhs}));
+ ASSERT_OK_AND_ASSIGN(Datum expected, CallFunction("and", {resultl,
resultr}));
+
+ ValidateBetween<ArrowType>(options, val, lhs, rhs, expected);
+}
+
+template <typename ArrowType>
+class TestNumericBetweenKernel : public ::testing::Test {};
+
+TYPED_TEST_SUITE(TestNumericBetweenKernel, NumericArrowTypes);
+TYPED_TEST(TestNumericBetweenKernel, SimpleBetweenArrayScalarScalar) {
Review comment:
Removed type parametrization. Needed to introduce a function get the
type. This function could possibly be put elsewhere. Maybe there is a better
way to get the type?
--
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]