From b7a2d62e34ccc94914bca71afcdf7ba38205a4ca Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Tue, 22 Mar 2022 09:24:32 +0000 Subject: [PATCH] planner: Updated failing test after #33098 (#33299) close pingcap/tidb#33297 --- planner/core/prepare_test.go | 14 ++++++++++---- unstable.txt | 3 +-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/planner/core/prepare_test.go b/planner/core/prepare_test.go index 6ef4c73aa9b08..a0d41f96c2cb1 100644 --- a/planner/core/prepare_test.go +++ b/planner/core/prepare_test.go @@ -2630,10 +2630,16 @@ func TestPartitionWithVariedDataSources(t *testing.T) { tk.MustExec(fmt.Sprintf(`set @a0=%v, @a1=%v, @a2=%v`, rand.Intn(40000), rand.Intn(40000), rand.Intn(40000))) var rscan, rlookup, rpoint, rbatch [][]interface{} + var expectedFromPlanCache string for id, tbl := range []string{"trangeIdx", "thashIdx", "tnormalIdx"} { scan := tk.MustQuery(fmt.Sprintf(`execute stmt%v_indexscan using @mina, @maxa`, tbl)).Sort() + if id == 2 { + expectedFromPlanCache = "1" + } else { + expectedFromPlanCache = "0" + } if i > 0 { - tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows("1")) + tk.MustQuery(`select @@last_plan_from_cache /* table: ` + tbl + " */").Check(testkit.Rows(expectedFromPlanCache)) } if id == 0 { rscan = scan.Rows() @@ -2643,7 +2649,7 @@ func TestPartitionWithVariedDataSources(t *testing.T) { lookup := tk.MustQuery(fmt.Sprintf(`execute stmt%v_indexlookup using @mina, @maxa`, tbl)).Sort() if i > 0 { - tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows("1")) + tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows(expectedFromPlanCache)) } if id == 0 { rlookup = lookup.Rows() @@ -2655,7 +2661,7 @@ func TestPartitionWithVariedDataSources(t *testing.T) { if tbl == `tnormalPK` && i > 0 { // PlanCache cannot support PointGet now since we haven't relocated partition after rebuilding range. // Please see Execute.rebuildRange for more details. - tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows("0")) + tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows(expectedFromPlanCache)) } if id == 0 { rpoint = point.Rows() @@ -2665,7 +2671,7 @@ func TestPartitionWithVariedDataSources(t *testing.T) { batch := tk.MustQuery(fmt.Sprintf(`execute stmt%v_batchget_idx using @a0, @a1, @a2`, tbl)).Sort() if i > 0 { - tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows("1")) + tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows(expectedFromPlanCache)) } if id == 0 { rbatch = batch.Rows() diff --git a/unstable.txt b/unstable.txt index 5de094539bc02..cffb45911e42e 100644 --- a/unstable.txt +++ b/unstable.txt @@ -27,8 +27,7 @@ planner/core TestPrepareCacheNow planner/core TestDAGPlanBuilderSplitAvg planner/core TestIndexMerge planner/core TestUnmatchedTableInHint -planner/core TestPartitionWithVariedDataSources planner/core TestCopPaging planner/core TestPlanCachePointGetAndTableDual planner/core TestSimplifyOuterJoinWithCast -executor/seqtest TestShow \ No newline at end of file +executor/seqtest TestShow