Skip to content

Commit

Permalink
add some test
Browse files Browse the repository at this point in the history
  • Loading branch information
wshwsh12 committed Dec 31, 2019
1 parent d83e9af commit 525d779
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions executor/sort_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
package executor_test

import (
"fmt"

. "github.com/pingcap/check"
"github.com/pingcap/tidb/config"
"github.com/pingcap/tidb/util"
Expand All @@ -37,9 +39,16 @@ func (s *testSuite) TestSortInDisk(c *C) {
s.domain.ExpensiveQueryHandle().SetSessionManager(sm)

tk.MustExec("set @@tidb_mem_quota_query=1;")
tk.MustExec("set @@tidb_max_chunk_size=32;")
tk.MustExec("drop table if exists t")
tk.MustExec("create table t(c1 int, c2 int)")
tk.MustExec("insert into t values(1,5),(2,4),(3,3),(4,2),(5,1)")
result := tk.MustQuery("select * from t order by c2")
result.Check(testkit.Rows("5 1", "4 2", "3 3", "2 4", "1 5"))
tk.MustExec("create table t(c1 int)")
for i := 0; i < 5; i++ {
for j := i; j < 1024; j += 5 {
tk.MustExec(fmt.Sprintf("insert into t values(%v)", j))
}
}
result := tk.MustQuery("select * from t order by c1")
for i := 0; i < 1024; i++ {
c.Assert(result.Rows()[i][0].(string), Equals, fmt.Sprint(i))
}
}

0 comments on commit 525d779

Please sign in to comment.