Skip to content

Commit

Permalink
add more unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
qw4990 committed Feb 20, 2019
1 parent d2f25b1 commit cc83665
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion executor/executor_required_rows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package executor
import (
"context"
"fmt"
"github.com/pingcap/tidb/util/memory"
"math"
"math/rand"

"github.com/cznic/mathutil"
Expand All @@ -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"
)

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit cc83665

Please sign in to comment.