Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed Feb 27, 2024
1 parent 73a273e commit 7cb424d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions velox/functions/prestosql/window/tests/AggregateWindowTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,5 +198,20 @@ TEST_F(AggregateWindowTest, testDecimal) {
testAggregate(DECIMAL(5, 2));
testAggregate(DECIMAL(20, 5));
}

TEST_F(AggregateWindowTest, integerOverflowRowsFrame) {
auto c0 = makeFlatVector<int64_t>({-1, -1, -1, -1, -1, -1, 2, 2, 2, 2});
auto c1 = makeFlatVector<double>({-1, -2, -3, -4, -5, -6, -7, -8, -9, -10});
auto input = makeRowVector({c0, c1});

auto expected = makeRowVector(
{c0, c1, makeFlatVector<int64_t>({6, 5, 4, 3, 2, 1, 4, 3, 2, 1})});
std::string overClause = "partition by c0 order by c1 desc";
// Use max value of int32_t.
std::string frameClause = "rows between 0 preceding and 2147483647 following";
WindowTestBase::testWindowFunction(
{input}, "count(c1)", overClause, frameClause, expected);
}

}; // namespace
}; // namespace facebook::velox::window::test

0 comments on commit 7cb424d

Please sign in to comment.