From 12cc0c4a5c18dd8c80ec2cdc4dbd474edfb3511a Mon Sep 17 00:00:00 2001 From: wshwsh12 <793703860@qq.com> Date: Mon, 7 Nov 2022 16:37:54 +0800 Subject: [PATCH] fix --- executor/merge_join_test.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/executor/merge_join_test.go b/executor/merge_join_test.go index 63e8b8f9d0b3e..7246589e40412 100644 --- a/executor/merge_join_test.go +++ b/executor/merge_join_test.go @@ -18,6 +18,7 @@ import ( "bytes" "fmt" "math/rand" + "sort" "strconv" "testing" @@ -255,19 +256,28 @@ func TestShuffleMergeJoinInDisk(t *testing.T) { tk.MustExec("set @@tidb_mem_quota_query=1;") tk.MustExec("set @@tidb_merge_join_concurrency=4;") + tk.MustExec("set @@tidb_max_chunk_size=32;") tk.MustExec("drop table if exists t") tk.MustExec("drop table if exists t1") tk.MustExec("create table t(c1 int, c2 int)") tk.MustExec("create table t1(c1 int, c2 int)") - tk.MustExec("insert into t values(1,1)") - tk.MustExec("insert into t1 values(1,3),(4,4)") - + tk.MustExec("insert into t values(1,1),(2,2),(3,3),(4,4)") + for i := 1; i <= 1024; i += 4 { + tk.MustExec(fmt.Sprintf("insert into t1 values(%v,%v),(%v,%v),(%v,%v),(%v,%v)", i, i, i+1, i+1, i+2, i+2, i+3, i+3)) + } result := checkMergeAndRun(tk, t, "select /*+ TIDB_SMJ(t) */ * from t1 left outer join t on t.c1 = t1.c1 where t.c1 = 1 or t1.c2 > 20") - result.Check(testkit.Rows("1 3 1 1")) + + var expect []string + expect = append(expect, "1 1 1 1") + for i := 21; i <= 1024; i++ { + expect = append(expect, fmt.Sprintf("%v %v ", i, i)) + } + sort.Strings(expect) + result.Sort().Check(testkit.Rows(expect...)) require.Equal(t, int64(0), tk.Session().GetSessionVars().MemTracker.BytesConsumed()) require.Greater(t, tk.Session().GetSessionVars().MemTracker.MaxConsumed(), int64(0)) require.Equal(t, int64(0), tk.Session().GetSessionVars().DiskTracker.BytesConsumed()) - require.GreaterOrEqual(t, tk.Session().GetSessionVars().DiskTracker.MaxConsumed(), int64(0)) + require.Greater(t, tk.Session().GetSessionVars().DiskTracker.MaxConsumed(), int64(0)) } func TestMergeJoinInDisk(t *testing.T) {