Skip to content

Commit

Permalink
Improve LimitTest for 64bit limit and offset. (facebookincubator#7948)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebookincubator#7948

Addressing comments from facebookincubator#7927

Reviewed By: xiaoxmeng

Differential Revision: D52004795

fbshipit-source-id: 0fd4d724c08f6b6d794c9565d527d83176f011ac
  • Loading branch information
amitkdutta authored and facebook-github-bot committed Dec 9, 2023
1 parent fa82b94 commit 1704f53
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions velox/exec/tests/LimitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,22 @@ TEST_F(LimitTest, basic) {
};

assertQuery(makePlan(0, 10), "SELECT * FROM tmp LIMIT 10");
int64_t limit = (int64_t)(std::numeric_limits<int32_t>::max()) + 1000000;
int64_t offset = (int64_t)(std::numeric_limits<int32_t>::max()) + 1000;
assertQuery(
makePlan(0, 100'0000'000'000), "SELECT * FROM tmp LIMIT 1000000000000");
makePlan(0, limit), fmt::format("SELECT * FROM tmp LIMIT {}", limit));
assertQuery(makePlan(0, 1'234), "SELECT * FROM tmp LIMIT 1234");

assertQuery(makePlan(17, 10), "SELECT * FROM tmp OFFSET 17 LIMIT 10");
assertQuery(makePlan(17, 983), "SELECT * FROM tmp OFFSET 17 LIMIT 983");
assertQuery(
makePlan(17, 100'0000'000'000),
"SELECT * FROM tmp OFFSET 17 LIMIT 1000000000000");
assertQuery(makePlan(17, 2'000), "SELECT * FROM tmp OFFSET 17 LIMIT 2000");
assertQuery(
makePlan(100'000'000'000, 100'0000'000'000),
"SELECT * FROM tmp OFFSET 100000000000 LIMIT 1000000000000");
makePlan(offset, limit),
fmt::format("SELECT * FROM tmp OFFSET {} LIMIT {}", offset, limit));

assertQuery(
makePlan(offset, 2000),
fmt::format("SELECT * FROM tmp OFFSET {} LIMIT 2000", offset));

assertQuery(makePlan(1'000, 145), "SELECT * FROM tmp OFFSET 1000 LIMIT 145");
assertQuery(
Expand Down

0 comments on commit 1704f53

Please sign in to comment.