diff --git a/velox/functions/sparksql/In.cpp b/velox/functions/sparksql/In.cpp index 91b1c144d1b5..8aea97fc2231 100644 --- a/velox/functions/sparksql/In.cpp +++ b/velox/functions/sparksql/In.cpp @@ -130,15 +130,12 @@ void registerInFn(const std::string& prefix) { {prefix + "in"}); } -void registerInFnForShortDecimal(const std::string& prefix) { +void registerInFnForDecimal(const std::string& prefix) { registerFunction< InFunctionOuter>::template Inner, bool, ShortDecimal, Array>>({prefix + "in"}); -} - -void registerInFnForLongDecimal(const std::string& prefix) { registerFunction< InFunctionOuter>::template Inner, bool, @@ -159,8 +156,7 @@ void registerIn(const std::string& prefix) { registerInFn(prefix); registerInFn(prefix); registerInFn(prefix); - registerInFnForShortDecimal(prefix); - registerInFnForLongDecimal(prefix); + registerInFnForDecimal(prefix); } } // namespace facebook::velox::functions::sparksql diff --git a/velox/functions/sparksql/tests/InTest.cpp b/velox/functions/sparksql/tests/InTest.cpp index d26e12d9ee0e..7d61cae7b14e 100644 --- a/velox/functions/sparksql/tests/InTest.cpp +++ b/velox/functions/sparksql/tests/InTest.cpp @@ -198,13 +198,6 @@ TEST_F(InTest, shortDecimal) { EXPECT_EQ(in(1, {1, 2}, DECIMAL(2, 1)), true); EXPECT_EQ(in(2, {1, 2}, DECIMAL(10, 5)), true); EXPECT_EQ(in(3, {1, 2}, DECIMAL(17, 11)), false); - EXPECT_EQ(in(std::nullopt, {1, 2}, DECIMAL(3, 2)), std::nullopt); - EXPECT_EQ(in(1, {1, std::nullopt, 2}, DECIMAL(3, 2)), true); - EXPECT_EQ(in(2, {1, std::nullopt, 2}, DECIMAL(3, 2)), true); - EXPECT_EQ(in(3, {1, std::nullopt, 2}, DECIMAL(3, 2)), std::nullopt); - EXPECT_EQ( - in(std::nullopt, {1, std::nullopt, 2}, DECIMAL(3, 2)), - std::nullopt); EXPECT_EQ( in( DecimalUtil::kShortDecimalMin, @@ -223,14 +216,6 @@ TEST_F(InTest, longDecimal) { EXPECT_EQ(in(1, {1, 2}, DECIMAL(21, 2)), true); EXPECT_EQ(in(2, {1, 2}, DECIMAL(29, 10)), true); EXPECT_EQ(in(3, {1, 2}, DECIMAL(35, 20)), false); - EXPECT_EQ(in(std::nullopt, {1, 2}, DECIMAL(23, 2)), std::nullopt); - EXPECT_EQ(in(1, {1, std::nullopt, 2}, DECIMAL(23, 2)), true); - EXPECT_EQ(in(2, {1, std::nullopt, 2}, DECIMAL(23, 2)), true); - EXPECT_EQ( - in(3, {1, std::nullopt, 2}, DECIMAL(23, 2)), std::nullopt); - EXPECT_EQ( - in(std::nullopt, {1, std::nullopt, 2}, DECIMAL(23, 2)), - std::nullopt); EXPECT_EQ( in( DecimalUtil::kLongDecimalMin,