From 7cb424d1893339dcabaf262bddf2b5f9e2fc0142 Mon Sep 17 00:00:00 2001 From: PHILO-HE Date: Tue, 27 Feb 2024 23:30:15 +0800 Subject: [PATCH] Add a test --- .../window/tests/AggregateWindowTest.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/velox/functions/prestosql/window/tests/AggregateWindowTest.cpp b/velox/functions/prestosql/window/tests/AggregateWindowTest.cpp index 3a362650af8c0..06d259f088bcc 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