diff --git a/velox/functions/prestosql/window/tests/AggregateWindowTest.cpp b/velox/functions/prestosql/window/tests/AggregateWindowTest.cpp index 3a362650af8c..06d259f088bc 100644 --- a/velox/functions/prestosql/window/tests/AggregateWindowTest.cpp +++ b/velox/functions/prestosql/window/tests/AggregateWindowTest.cpp @@ -198,5 +198,20 @@ TEST_F(AggregateWindowTest, testDecimal) { testAggregate(DECIMAL(5, 2)); testAggregate(DECIMAL(20, 5)); } + +TEST_F(AggregateWindowTest, integerOverflowRowsFrame) { + auto c0 = makeFlatVector({-1, -1, -1, -1, -1, -1, 2, 2, 2, 2}); + auto c1 = makeFlatVector({-1, -2, -3, -4, -5, -6, -7, -8, -9, -10}); + auto input = makeRowVector({c0, c1}); + + auto expected = makeRowVector( + {c0, c1, makeFlatVector({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