bkmgit commented on a change in pull request #11882:
URL: https://github.com/apache/arrow/pull/11882#discussion_r787036818
##########
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) {
+ using ScalarType = typename TypeTraits<TypeParam>::ScalarType;
+ using CType = typename TypeTraits<TypeParam>::CType;
+
+ Datum zero(std::make_shared<ScalarType>(CType(0)));
+ Datum four(std::make_shared<ScalarType>(CType(4)));
+ Datum null(std::make_shared<ScalarType>());
+ BetweenOptions InclusiveBoth(BetweenOptions::Inclusive::BOTH);
+ ValidateBetween<TypeParam>(
+ InclusiveBoth, ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[]"), zero,
+ four, ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[]"));
+ ValidateBetween<TypeParam>(
+ InclusiveBoth, ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[null]"),
+ zero, four, ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[null]"));
+ ValidateBetween<TypeParam>(
+ InclusiveBoth,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,0,1,1,2,2]"),
zero, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[1,1,1,1,1,1]"));
+ ValidateBetween<TypeParam>(
+ InclusiveBoth,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,1,2,3,4,5]"),
zero, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[1,1,1,1,1,0]"));
+ ValidateBetween<TypeParam>(
+ InclusiveBoth,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[5,4,3,2,1,0]"),
zero, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[0,1,1,1,1,1]"));
+ ValidateBetween<TypeParam>(
+ InclusiveBoth,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null,0,1,1]"),
zero, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[null,1,1,1]"));
+ ValidateBetween<TypeParam>(
+ InclusiveBoth,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[5,4,3,2,1,0]"),
null, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[null,null,null,null,null,null]"));
+ ValidateBetween<TypeParam>(
+ InclusiveBoth,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[5,4,3,2,1,0]"),
zero, null,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[null,null,null,null,null,null]"));
+ BetweenOptions InclusiveLeft(BetweenOptions::Inclusive::LEFT);
+ ValidateBetween<TypeParam>(
+ InclusiveLeft, ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[]"), zero,
+ four, ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[]"));
+ ValidateBetween<TypeParam>(
+ InclusiveLeft, ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[null]"),
+ zero, four, ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[null]"));
+ ValidateBetween<TypeParam>(
+ InclusiveLeft,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,0,1,1,2,2]"),
zero, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[1,1,1,1,1,1]"));
+ ValidateBetween<TypeParam>(
+ InclusiveLeft,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,1,2,3,4,5]"),
zero, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[1,1,1,1,0,0]"));
+ ValidateBetween<TypeParam>(
+ InclusiveLeft,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[5,4,3,2,1,0]"),
zero, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[0,0,1,1,1,1]"));
+ ValidateBetween<TypeParam>(
+ InclusiveLeft,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null,0,1,1]"),
zero, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[null,1,1,1]"));
+ ValidateBetween<TypeParam>(
+ InclusiveLeft,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[5,4,3,2,1,0]"),
null, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[null,null,null,null,null,null]"));
+ ValidateBetween<TypeParam>(
+ InclusiveLeft,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[5,4,3,2,1,0]"),
zero, null,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[null,null,null,null,null,null]"));
+ BetweenOptions InclusiveRight(BetweenOptions::Inclusive::RIGHT);
+ ValidateBetween<TypeParam>(
+ InclusiveRight, ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[]"), zero,
+ four, ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[]"));
+ ValidateBetween<TypeParam>(
+ InclusiveRight, ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[null]"),
+ zero, four, ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[null]"));
+ ValidateBetween<TypeParam>(
+ InclusiveRight,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,0,1,1,2,2]"),
zero, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[0,0,1,1,1,1]"));
+ ValidateBetween<TypeParam>(
+ InclusiveRight,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,1,2,3,4,5]"),
zero, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[0,1,1,1,1,0]"));
+ ValidateBetween<TypeParam>(
+ InclusiveRight,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[5,4,3,2,1,0]"),
zero, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[0,1,1,1,1,0]"));
+ ValidateBetween<TypeParam>(
+ InclusiveRight,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null,0,1,1]"),
zero, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[null,0,1,1]"));
+ ValidateBetween<TypeParam>(
+ InclusiveRight,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[5,4,3,2,1,0]"),
null, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[null,null,null,null,null,null]"));
+ ValidateBetween<TypeParam>(
+ InclusiveRight,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[5,4,3,2,1,0]"),
zero, null,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[null,null,null,null,null,null]"));
+ BetweenOptions InclusiveNeither(BetweenOptions::Inclusive::NEITHER);
+ ValidateBetween<TypeParam>(
+ InclusiveNeither, ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[]"),
+ zero, four, ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[]"));
+ ValidateBetween<TypeParam>(
+ InclusiveNeither, ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[null]"),
+ zero, four, ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[null]"));
+ ValidateBetween<TypeParam>(
+ InclusiveNeither,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,0,1,1,2,2]"),
zero, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[0,0,1,1,1,1]"));
+ ValidateBetween<TypeParam>(
+ InclusiveNeither,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,1,2,3,4,5]"),
zero, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[0,1,1,1,0,0]"));
+ ValidateBetween<TypeParam>(
+ InclusiveNeither,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[5,4,3,2,1,0]"),
zero, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[0,0,1,1,1,0]"));
+ ValidateBetween<TypeParam>(
+ InclusiveNeither,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null,0,1,1]"),
zero, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
"[null,0,1,1]"));
+ ValidateBetween<TypeParam>(
+ InclusiveNeither,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[5,4,3,2,1,0]"),
null, four,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[null,null,null,null,null,null]"));
+ ValidateBetween<TypeParam>(
+ InclusiveNeither,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[5,4,3,2,1,0]"),
zero, null,
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[null,null,null,null,null,null]"));
+}
+
+TYPED_TEST(TestNumericBetweenKernel, SimpleBetweenScalarArrayArray) {
+ using ScalarType = typename TypeTraits<TypeParam>::ScalarType;
+ using CType = typename TypeTraits<TypeParam>::CType;
+
+ Datum one(std::make_shared<ScalarType>(CType(1)));
+
+ BetweenOptions InclusiveBoth(BetweenOptions::Inclusive::BOTH);
+ ValidateBetween<TypeParam>(
+ InclusiveBoth, one,
ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[]"));
+ ValidateBetween<TypeParam>(
+ InclusiveBoth, one,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[null]"));
+ ValidateBetween<TypeParam>(
+ InclusiveBoth, one,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,0,1,3,3]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[10,10,2,5,5]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[true,true,true,false,false]"));
+ ValidateBetween<TypeParam>(
+ InclusiveBoth, one,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[0,0,1,null,3,3]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,10,2,2,5,5]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[false,true,true,null,false,false]"));
+ BetweenOptions InclusiveLeft(BetweenOptions::Inclusive::LEFT);
+ ValidateBetween<TypeParam>(
+ InclusiveLeft, one,
ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[]"));
+ ValidateBetween<TypeParam>(
+ InclusiveLeft, one,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[null]"));
+ ValidateBetween<TypeParam>(
+ InclusiveLeft, one,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,0,1,3,3]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[10,10,2,5,5]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[true,true,true,false,false]"));
+ ValidateBetween<TypeParam>(
+ InclusiveLeft, one,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[0,0,1,null,3,3]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,10,2,2,5,5]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[false,true,true,null,false,false]"));
+ BetweenOptions InclusiveRight(BetweenOptions::Inclusive::RIGHT);
+ ValidateBetween<TypeParam>(
+ InclusiveRight, one,
ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[]"));
+ ValidateBetween<TypeParam>(
+ InclusiveRight, one,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[null]"));
+ ValidateBetween<TypeParam>(
+ InclusiveRight, one,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,0,1,3,3]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[10,10,2,5,5]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[true,true,false,false,false]"));
+ ValidateBetween<TypeParam>(
+ InclusiveRight, one,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[0,0,1,null,3,3]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,10,2,2,5,5]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[false,true,false,null,false,false]"));
+ BetweenOptions InclusiveNeither(BetweenOptions::Inclusive::NEITHER);
+ ValidateBetween<TypeParam>(
+ InclusiveNeither, one,
ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[]"));
+ ValidateBetween<TypeParam>(
+ InclusiveNeither, one,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[null]"));
+ ValidateBetween<TypeParam>(
+ InclusiveNeither, one,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,0,1,3,3]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[10,10,2,5,5]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[true,true,false,false,false]"));
+ ValidateBetween<TypeParam>(
+ InclusiveNeither, one,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[0,0,1,null,3,3]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,10,2,2,5,5]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[false,true,false,null,false,false]"));
+}
+
+TYPED_TEST(TestNumericBetweenKernel, SimpleBetweenArrayArrayArray) {
+ BetweenOptions InclusiveBoth(BetweenOptions::Inclusive::BOTH);
+ ValidateBetween<TypeParam>(
+ InclusiveBoth, ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[]"));
+ ValidateBetween<TypeParam>(
+ InclusiveBoth, ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[null]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[null]"));
+ ValidateBetween<TypeParam>(
+ InclusiveBoth,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[1,1,2,2,2]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,0,1,3,3]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[10,10,2,5,5]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[true,true,true,false,false]"));
+ ValidateBetween<TypeParam>(
+ InclusiveBoth,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,1,2,2,2,2]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[0,0,1,null,3,3]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,10,2,2,5,5]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[true,true,true,null,false,false]"));
+ BetweenOptions InclusiveLeft(BetweenOptions::Inclusive::LEFT);
+ ValidateBetween<TypeParam>(
+ InclusiveLeft, ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[]"));
+ ValidateBetween<TypeParam>(
+ InclusiveLeft, ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[null]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[null]"));
+ ValidateBetween<TypeParam>(
+ InclusiveLeft,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[1,1,2,2,2]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,0,1,3,3]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[10,10,2,5,5]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[true,true,false,false,false]"));
+ ValidateBetween<TypeParam>(
+ InclusiveLeft,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,1,2,2,2,2]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[0,0,1,null,3,3]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,10,2,2,5,5]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[false,true,false,null,false,false]"));
+ BetweenOptions InclusiveRight(BetweenOptions::Inclusive::RIGHT);
+ ValidateBetween<TypeParam>(
+ InclusiveRight, ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[]"));
+ ValidateBetween<TypeParam>(
+ InclusiveRight, ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[null]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[null]"));
+ ValidateBetween<TypeParam>(
+ InclusiveRight,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[1,1,2,2,2]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,0,1,3,3]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[10,10,2,5,5]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[true,true,true,false,false]"));
+ ValidateBetween<TypeParam>(
+ InclusiveRight,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,1,2,2,2,2]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[0,0,1,null,3,3]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,10,2,2,5,5]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[false,true,true,null,false,false]"));
+ BetweenOptions InclusiveNeither(BetweenOptions::Inclusive::NEITHER);
+ ValidateBetween<TypeParam>(
+ InclusiveNeither, ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[]"));
+ ValidateBetween<TypeParam>(
+ InclusiveNeither, ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[null]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[null]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), "[null]"));
+ ValidateBetween<TypeParam>(
+ InclusiveNeither,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[1,1,2,2,2]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,0,1,3,3]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[10,10,2,5,5]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[true,true,false,false,false]"));
+ ValidateBetween<TypeParam>(
+ InclusiveNeither,
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,1,2,2,2,2]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(),
"[0,0,1,null,3,3]"),
+ ArrayFromJSON(TypeTraits<TypeParam>::type_singleton(), "[0,10,2,2,5,5]"),
+ ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(),
+ "[false,true,false,null,false,false]"));
+}
+
+template <typename Type>
+struct BetweenRandomNumeric {
+ static void Test(const std::shared_ptr<DataType>& type) {
+ using ScalarType = typename TypeTraits<Type>::ScalarType;
+ using CType = typename TypeTraits<Type>::CType;
+ auto rand = random::RandomArrayGenerator(0x5416447);
+ const int64_t length = 1000;
Review comment:
Ok. Also changed CompareRandomNumeric to 1000.
--
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]