From cc836657660923e33d00079449b8822031ac0b5c Mon Sep 17 00:00:00 2001 From: qw4990 Date: Wed, 20 Feb 2019 14:57:05 +0800 Subject: [PATCH] add more unit tests --- executor/executor_required_rows_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/executor/executor_required_rows_test.go b/executor/executor_required_rows_test.go index afa8fad2e1591..111583c6ee379 100644 --- a/executor/executor_required_rows_test.go +++ b/executor/executor_required_rows_test.go @@ -16,7 +16,7 @@ package executor import ( "context" "fmt" - "github.com/pingcap/tidb/util/memory" + "math" "math/rand" "github.com/cznic/mathutil" @@ -28,6 +28,7 @@ import ( "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" + "github.com/pingcap/tidb/util/memory" "github.com/pingcap/tidb/util/mock" ) @@ -325,6 +326,15 @@ func (s *testExecSuite) TestTopNRequiredRows(c *C) { expectedRows: []int{0, 0, 0}, expectedRowsDS: []int{maxChunkSize, maxChunkSize, maxChunkSize, maxChunkSize, maxChunkSize, 10, 0, 0}, }, + { + totalRows: maxChunkSize + maxChunkSize + 10, + topNOffset: 10, + topNCount: math.MaxInt64, + groupBy: []int{0, 1}, + requiredRows: []int{1, 2, 3, maxChunkSize, maxChunkSize}, + expectedRows: []int{1, 2, 3, maxChunkSize, maxChunkSize - 1 - 2 - 3}, + expectedRowsDS: []int{maxChunkSize, maxChunkSize, 10, 0, 0}, + }, } for _, testCase := range testCases {