Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zhli1142015 committed Dec 25, 2024
1 parent 3703527 commit 93b9831
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
8 changes: 2 additions & 6 deletions velox/functions/sparksql/In.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ShortDecimal<P1, S1>>::template Inner,
bool,
ShortDecimal<P1, S1>,
Array<ShortDecimal<P1, S1>>>({prefix + "in"});
}

void registerInFnForLongDecimal(const std::string& prefix) {
registerFunction<
InFunctionOuter<LongDecimal<P1, S1>>::template Inner,
bool,
Expand All @@ -159,8 +156,7 @@ void registerIn(const std::string& prefix) {
registerInFn<Varchar>(prefix);
registerInFn<Timestamp>(prefix);
registerInFn<Date>(prefix);
registerInFnForShortDecimal(prefix);
registerInFnForLongDecimal(prefix);
registerInFnForDecimal(prefix);
}

} // namespace facebook::velox::functions::sparksql
15 changes: 0 additions & 15 deletions velox/functions/sparksql/tests/InTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,6 @@ TEST_F(InTest, shortDecimal) {
EXPECT_EQ(in<int64_t>(1, {1, 2}, DECIMAL(2, 1)), true);
EXPECT_EQ(in<int64_t>(2, {1, 2}, DECIMAL(10, 5)), true);
EXPECT_EQ(in<int64_t>(3, {1, 2}, DECIMAL(17, 11)), false);
EXPECT_EQ(in<int64_t>(std::nullopt, {1, 2}, DECIMAL(3, 2)), std::nullopt);
EXPECT_EQ(in<int64_t>(1, {1, std::nullopt, 2}, DECIMAL(3, 2)), true);
EXPECT_EQ(in<int64_t>(2, {1, std::nullopt, 2}, DECIMAL(3, 2)), true);
EXPECT_EQ(in<int64_t>(3, {1, std::nullopt, 2}, DECIMAL(3, 2)), std::nullopt);
EXPECT_EQ(
in<int64_t>(std::nullopt, {1, std::nullopt, 2}, DECIMAL(3, 2)),
std::nullopt);
EXPECT_EQ(
in<int64_t>(
DecimalUtil::kShortDecimalMin,
Expand All @@ -223,14 +216,6 @@ TEST_F(InTest, longDecimal) {
EXPECT_EQ(in<int128_t>(1, {1, 2}, DECIMAL(21, 2)), true);
EXPECT_EQ(in<int128_t>(2, {1, 2}, DECIMAL(29, 10)), true);
EXPECT_EQ(in<int128_t>(3, {1, 2}, DECIMAL(35, 20)), false);
EXPECT_EQ(in<int128_t>(std::nullopt, {1, 2}, DECIMAL(23, 2)), std::nullopt);
EXPECT_EQ(in<int128_t>(1, {1, std::nullopt, 2}, DECIMAL(23, 2)), true);
EXPECT_EQ(in<int128_t>(2, {1, std::nullopt, 2}, DECIMAL(23, 2)), true);
EXPECT_EQ(
in<int128_t>(3, {1, std::nullopt, 2}, DECIMAL(23, 2)), std::nullopt);
EXPECT_EQ(
in<int128_t>(std::nullopt, {1, std::nullopt, 2}, DECIMAL(23, 2)),
std::nullopt);
EXPECT_EQ(
in<int128_t>(
DecimalUtil::kLongDecimalMin,
Expand Down

0 comments on commit 93b9831

Please sign in to comment.