From d048aade8d9fdf53fcd8cba6e98391f0fed738d9 Mon Sep 17 00:00:00 2001 From: qw4990 Date: Thu, 3 Nov 2022 16:15:25 +0800 Subject: [PATCH 1/6] fixup --- executor/executor_test.go | 5 ++-- executor/join_test.go | 7 +++-- expression/constant_propagation_test.go | 1 + expression/testdata/expression_suite_out.json | 8 ++--- planner/core/cbo_test.go | 4 +++ planner/core/plan_cost_ver2.go | 4 +++ planner/core/testdata/analyze_suite_out.json | 30 +++++++++---------- 7 files changed, 35 insertions(+), 24 deletions(-) diff --git a/executor/executor_test.go b/executor/executor_test.go index af5608a78aefa..80e6e89a55348 100644 --- a/executor/executor_test.go +++ b/executor/executor_test.go @@ -3972,12 +3972,13 @@ func TestApplyCache(t *testing.T) { tk := testkit.NewTestKit(t, store) tk.MustExec("use test;") + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec("drop table if exists t;") tk.MustExec("create table t(a int);") tk.MustExec("insert into t values (1),(1),(1),(1),(1),(1),(1),(1),(1);") tk.MustExec("analyze table t;") result := tk.MustQuery("explain analyze SELECT count(1) FROM (SELECT (SELECT min(a) FROM t as t2 WHERE t2.a > t1.a) AS a from t as t1) t;") - require.Equal(t, "└─Apply_39", result.Rows()[1][0]) + require.Contains(t, result.Rows()[1][0], "Apply") var ( ind int flag bool @@ -3997,7 +3998,7 @@ func TestApplyCache(t *testing.T) { tk.MustExec("insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9);") tk.MustExec("analyze table t;") result = tk.MustQuery("explain analyze SELECT count(1) FROM (SELECT (SELECT min(a) FROM t as t2 WHERE t2.a > t1.a) AS a from t as t1) t;") - require.Equal(t, "└─Apply_39", result.Rows()[1][0]) + require.Contains(t, result.Rows()[1][0], "Apply") flag = false value = (result.Rows()[1][5]).(string) for ind = 0; ind < len(value)-5; ind++ { diff --git a/executor/join_test.go b/executor/join_test.go index 6e193a74fac30..2e402308e6c25 100644 --- a/executor/join_test.go +++ b/executor/join_test.go @@ -198,9 +198,9 @@ func TestJoin2(t *testing.T) { tk.MustQuery("select /*+ INL_JOIN(t, t1) */ t1.b from t1 join t on t.b=t1.b").Check(testkit.Rows("2", "3")) tk.MustQuery("select /*+ INL_HASH_JOIN(t, t1) */ t1.b from t1 join t on t.b=t1.b").Sort().Check(testkit.Rows("2", "3")) tk.MustQuery("select /*+ INL_MERGE_JOIN(t, t1) */ t1.b from t1 join t on t.b=t1.b").Check(testkit.Rows("2", "3")) - tk.MustQuery("select /*+ INL_JOIN(t1) */ * from t right outer join t1 on t.a=t1.a").Check(testkit.Rows("1 1 1 2", "1 1 1 3", "1 1 1 4", "3 3 3 4", " 4 5")) - tk.MustQuery("select /*+ INL_HASH_JOIN(t1) */ * from t right outer join t1 on t.a=t1.a").Check(testkit.Rows("1 1 1 2", "1 1 1 3", "1 1 1 4", "3 3 3 4", " 4 5")) - tk.MustQuery("select /*+ INL_MERGE_JOIN(t1) */ * from t right outer join t1 on t.a=t1.a").Check(testkit.Rows("1 1 1 2", "1 1 1 3", "1 1 1 4", "3 3 3 4", " 4 5")) + tk.MustQuery("select /*+ INL_JOIN(t1) */ * from t right outer join t1 on t.a=t1.a").Sort().Check(testkit.Rows("1 1 1 2", "1 1 1 3", "1 1 1 4", "3 3 3 4", " 4 5")) + tk.MustQuery("select /*+ INL_HASH_JOIN(t1) */ * from t right outer join t1 on t.a=t1.a").Sort().Check(testkit.Rows("1 1 1 2", "1 1 1 3", "1 1 1 4", "3 3 3 4", " 4 5")) + tk.MustQuery("select /*+ INL_MERGE_JOIN(t1) */ * from t right outer join t1 on t.a=t1.a").Sort().Check(testkit.Rows("1 1 1 2", "1 1 1 3", "1 1 1 4", "3 3 3 4", " 4 5")) tk.MustQuery("select /*+ INL_JOIN(t) */ avg(t.b) from t right outer join t1 on t.a=t1.a").Check(testkit.Rows("1.5000")) tk.MustQuery("select /*+ INL_HASH_JOIN(t) */ avg(t.b) from t right outer join t1 on t.a=t1.a").Check(testkit.Rows("1.5000")) tk.MustQuery("select /*+ INL_MERGE_JOIN(t) */ avg(t.b) from t right outer join t1 on t.a=t1.a").Check(testkit.Rows("1.5000")) @@ -1222,6 +1222,7 @@ func TestIndexLookupJoin(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec("set @@tidb_init_chunk_size=2") tk.MustExec("DROP TABLE IF EXISTS t") tk.MustExec("CREATE TABLE `t` (`a` int, pk integer auto_increment,`b` char (20),primary key (pk))") diff --git a/expression/constant_propagation_test.go b/expression/constant_propagation_test.go index 9c10d9ddd982b..d2ebfdef4080d 100644 --- a/expression/constant_propagation_test.go +++ b/expression/constant_propagation_test.go @@ -27,6 +27,7 @@ func TestOuterJoinPropConst(t *testing.T) { tk := testkit.NewTestKit(t, store) tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec("drop table if exists t1, t2;") tk.MustExec("create table t1(id bigint primary key, a int, b int);") tk.MustExec("create table t2(id bigint primary key, a int, b int);") diff --git a/expression/testdata/expression_suite_out.json b/expression/testdata/expression_suite_out.json index 7047b62ba1156..164ccd7f50311 100644 --- a/expression/testdata/expression_suite_out.json +++ b/expression/testdata/expression_suite_out.json @@ -65,11 +65,11 @@ "Result": [ "HashJoin 4166.67 root right outer join, equal:[eq(test.t1.a, test.t2.a)]", "├─TableReader(Build) 3333.33 root data:Selection", - "│ └─Selection 3333.33 cop[tikv] gt(test.t1.a, 1), not(isnull(test.t1.a))", - "│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Selection 3333.33 cop[tikv] gt(test.t2.a, 1)", + "│ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader(Probe) 3333.33 root data:Selection", - " └─Selection 3333.33 cop[tikv] gt(test.t2.a, 1)", - " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + " └─Selection 3333.33 cop[tikv] gt(test.t1.a, 1), not(isnull(test.t1.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ] }, { diff --git a/planner/core/cbo_test.go b/planner/core/cbo_test.go index c88edf4470d9b..6f8a67889dc2d 100644 --- a/planner/core/cbo_test.go +++ b/planner/core/cbo_test.go @@ -167,6 +167,7 @@ func TestEstimation(t *testing.T) { statistics.RatioOfPseudoEstimate.Store(10.0) defer statistics.RatioOfPseudoEstimate.Store(0.7) testKit.MustExec("use test") + testKit.MustExec("set tidb_cost_model_version=2") testKit.MustExec("create table t (a int)") testKit.MustExec("insert into t values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10)") testKit.MustExec("insert into t select * from t") @@ -211,6 +212,7 @@ func constructInsertSQL(i, n int) string { func TestIndexRead(t *testing.T) { store, dom := testkit.CreateMockStoreAndDomain(t) testKit := testkit.NewTestKit(t, store) + testKit.MustExec("set tidb_cost_model_version=2") testKit.MustExec("set @@session.tidb_executor_concurrency = 4;") testKit.MustExec("set @@session.tidb_hash_join_concurrency = 5;") testKit.MustExec("set @@session.tidb_distsql_scan_concurrency = 15;") @@ -662,6 +664,7 @@ func TestLimitCrossEstimation(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec("set @@session.tidb_executor_concurrency = 4;") tk.MustExec("set @@session.tidb_hash_join_concurrency = 5;") tk.MustExec("set @@session.tidb_distsql_scan_concurrency = 15;") @@ -796,6 +799,7 @@ func TestLimitIndexEstimation(t *testing.T) { tk := testkit.NewTestKit(t, store) tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec("drop table if exists t") tk.MustExec("create table t(a int, b int, key idx_a(a), key idx_b(b))") tk.MustExec("set session tidb_enable_extended_stats = on") diff --git a/planner/core/plan_cost_ver2.go b/planner/core/plan_cost_ver2.go index 595670e730982..ef4be46bee174 100644 --- a/planner/core/plan_cost_ver2.go +++ b/planner/core/plan_cost_ver2.go @@ -425,6 +425,10 @@ func (p *PhysicalHashAgg) getPlanCostVer2(taskType property.TaskType, option *Pl memFactor := getTaskMemFactorVer2(p, taskType) concurrency := float64(p.ctx.GetSessionVars().HashAggFinalConcurrency()) + if inputRows < 2000 { // prefer to use StreamAgg if no much data to process + inputRows = 2000 + } + aggCost := aggCostVer2(option, inputRows, p.AggFuncs, cpuFactor) groupCost := groupCostVer2(option, inputRows, p.GroupByItems, cpuFactor) hashBuildCost := hashBuildCostVer2(option, outputRows, outputRowSize, p.GroupByItems, cpuFactor, memFactor) diff --git a/planner/core/testdata/analyze_suite_out.json b/planner/core/testdata/analyze_suite_out.json index e1fbcba55ee34..68d5acacc0ec9 100644 --- a/planner/core/testdata/analyze_suite_out.json +++ b/planner/core/testdata/analyze_suite_out.json @@ -160,13 +160,13 @@ ], "Plan": [ "Limit 1.00 root offset:0, count:1", - "└─IndexJoin 1.00 root left outer semi join, inner:IndexReader, outer key:test.t.a, inner key:test.t.b, equal cond:eq(test.t.a, test.t.b)", - " ├─TopN(Build) 1.00 root test.t.a, offset:0, count:1", - " │ └─IndexReader 1.00 root index:TopN", - " │ └─TopN 1.00 cop[tikv] test.t.a, offset:0, count:1", - " │ └─IndexRangeScan 6.00 cop[tikv] table:t1, index:idx_bc(b, c) range:[-inf,6], keep order:false", - " └─IndexReader(Probe) 1.04 root index:IndexRangeScan", - " └─IndexRangeScan 1.04 cop[tikv] table:t2, index:idx_bc(b, c) range: decided by [eq(test.t.b, test.t.a)], keep order:false" + "└─MergeJoin 1.00 root left outer semi join, left key:test.t.a, right key:test.t.b", + " ├─IndexReader(Build) 25.00 root index:IndexFullScan", + " │ └─IndexFullScan 25.00 cop[tikv] table:t2, index:idx_bc(b, c) keep order:true", + " └─TopN(Probe) 1.00 root test.t.a, offset:0, count:1", + " └─IndexReader 1.00 root index:TopN", + " └─TopN 1.00 cop[tikv] test.t.a, offset:0, count:1", + " └─IndexRangeScan 6.00 cop[tikv] table:t1, index:idx_bc(b, c) range:[-inf,6], keep order:false" ] }, { @@ -433,13 +433,13 @@ { "Name": "TestIndexRead", "Cases": [ - "IndexReader(Index(t.e)[[NULL,+inf]])->HashAgg", + "IndexReader(Index(t.e)[[NULL,+inf]]->StreamAgg)->StreamAgg", "IndexReader(Index(t.e)[[-inf,10]]->StreamAgg)->StreamAgg", "IndexReader(Index(t.e)[[-inf,50]]->StreamAgg)->StreamAgg", - "IndexReader(Index(t.b_c)[[NULL,+inf]]->Sel([gt(test.t.c, 1)])->HashAgg)->HashAgg", + "IndexReader(Index(t.b_c)[[NULL,+inf]]->Sel([gt(test.t.c, 1)])->StreamAgg)->StreamAgg", "IndexLookUp(Index(t.e)[[1,1]], Table(t))->HashAgg", "TableReader(Table(t)->Sel([gt(test.t.e, 1)])->HashAgg)->HashAgg", - "IndexLookUp(Index(t.b)[[-inf,20]], Table(t)->HashAgg)->HashAgg", + "TableReader(Table(t)->Sel([le(test.t.b, 20)])->StreamAgg)->StreamAgg", "TableReader(Table(t)->Sel([le(test.t.b, 30)])->StreamAgg)->StreamAgg", "TableReader(Table(t)->Sel([le(test.t.b, 40)])->StreamAgg)->StreamAgg", "TableReader(Table(t)->Sel([le(test.t.b, 50)])->StreamAgg)->StreamAgg", @@ -449,7 +449,7 @@ "TableReader(Table(t)->Sel([le(test.t.b, 10000000000)]))", "TableReader(Table(t)->Sel([le(test.t.b, 50)]))", "TableReader(Table(t)->Sel([le(test.t.b, 100)])->Limit)->Limit", - "IndexLookUp(Index(t.b)[[-inf,1]]->TopN([test.t.a],0,10), Table(t))->TopN([test.t.a],0,10)", + "TableReader(Table(t)->Sel([le(test.t.b, 1)])->Limit)->Limit", "IndexLookUp(Index(t.b)[[1,1]], Table(t))", "IndexLookUp(Index(t.d)[[-inf,1991-09-05 00:00:00)], Table(t))", "IndexLookUp(Index(t.ts)[[-inf,1991-09-05 00:00:00)], Table(t))", @@ -501,10 +501,10 @@ "SQL": "explain format = 'brief' select * from t where a <= 10000 order by b limit 1", "Plan": [ "TopN 1.00 root test.t.b, offset:0, count:1", - "└─IndexLookUp 1.00 root ", - " ├─IndexRangeScan(Build) 10000.00 cop[tikv] table:t, index:idx_a(a) range:[-inf,10000], keep order:false", - " └─TopN(Probe) 1.00 cop[tikv] test.t.b, offset:0, count:1", - " └─TableRowIDScan 10000.00 cop[tikv] table:t keep order:false" + "└─TableReader 1.00 root data:TopN", + " └─TopN 1.00 cop[tikv] test.t.b, offset:0, count:1", + " └─Selection 10000.00 cop[tikv] le(test.t.a, 10000)", + " └─TableFullScan 1000000.00 cop[tikv] table:t keep order:false" ] }, { From 885552d3f6e6e63731e025579b8ddfa526533113 Mon Sep 17 00:00:00 2001 From: qw4990 Date: Thu, 3 Nov 2022 17:50:56 +0800 Subject: [PATCH 2/6] fixup --- planner/core/integration_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index 98f494da8ee54..4f9657c481908 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -68,7 +68,7 @@ func TestShowSubquery(t *testing.T) { )) tk.MustQuery("show columns from t where field in (select 'b') and false").Check(testkit.Rows()) tk.MustExec("insert into t values('c', 0, 0)") - tk.MustQuery("show columns from t where field < all (select a from t)").Check(testkit.Rows( + tk.MustQuery("show columns from t where field < all (select a from t)").Sort().Check(testkit.Rows( "a varchar(10) YES ", "b int(11) YES ", )) From 28ab270b63f8b4d0cb775dc3ccf6e872d866e7d8 Mon Sep 17 00:00:00 2001 From: qw4990 Date: Thu, 3 Nov 2022 17:59:44 +0800 Subject: [PATCH 3/6] fixup --- planner/core/integration_test.go | 1 + .../core/testdata/integration_suite_in.json | 8 +- .../core/testdata/integration_suite_out.json | 225 +++++++++--------- 3 files changed, 117 insertions(+), 117 deletions(-) diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index 4f9657c481908..59e918c24cd09 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -471,6 +471,7 @@ func TestVerboseExplain(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec(`set tidb_opt_limit_push_down_threshold=0`) tk.MustExec("drop table if exists t1, t2, t3") tk.MustExec("create table t1(a int, b int)") diff --git a/planner/core/testdata/integration_suite_in.json b/planner/core/testdata/integration_suite_in.json index 6855084993514..0505e7437d43b 100644 --- a/planner/core/testdata/integration_suite_in.json +++ b/planner/core/testdata/integration_suite_in.json @@ -468,10 +468,10 @@ "explain format = 'verbose' select /*+ use_index(t3, c) */ count(a) from t3 where b = 0", "explain format = 'verbose' select count(*) from t2 where a = 0", "explain format = 'verbose' select count(*) from t3 t join t3 on t.a = t3.b", - "explain format = 'verbose' select count(*) from t1 join t2 on t1.a = t2.a", - "explain format = 'verbose' select count(*) from t1 join t2 on t1.a = t2.a join t3 on t1.b = t3.b", - "explain format = 'verbose' select (2) in (select count(*) from t1) from (select t.b < (select t.b from t2 limit 1 ) from t3 t) t", - "explain format = 'verbose' select /*+ merge_join(t1) */ count(*) from t1 join t2 on t1.a = t2.a" + "explain format = 'verbose' select /*+ read_from_storage(tiflash[t1, t2]) */ count(*) from t1 join t2 on t1.a = t2.a", + "explain format = 'verbose' select /*+ read_from_storage(tiflash[t1, t2]) */ count(*) from t1 join t2 on t1.a = t2.a join t3 on t1.b = t3.b", + "explain format = 'verbose' select /*+ read_from_storage(tiflash[t1, t2]) */ (2) in (select count(*) from t1) from (select t.b < (select t.b from t2 limit 1 ) from t3 t) t", + "explain format = 'verbose' select /*+ merge_join(t1), read_from_storage(tiflash[t1, t2]) */ count(*) from t1 join t2 on t1.a = t2.a" ] }, diff --git a/planner/core/testdata/integration_suite_out.json b/planner/core/testdata/integration_suite_out.json index a18436924f455..a72a818987402 100644 --- a/planner/core/testdata/integration_suite_out.json +++ b/planner/core/testdata/integration_suite_out.json @@ -2485,80 +2485,80 @@ { "SQL": "explain format = 'verbose' select count(*) from t3", "Plan": [ - "StreamAgg_20 1.00 12.68 root funcs:count(Column#9)->Column#4", - "└─TableReader_21 1.00 9.68 root data:StreamAgg_8", - " └─StreamAgg_8 1.00 117.00 cop[tikv] funcs:count(1)->Column#9", - " └─TableFullScan_18 3.00 108.00 cop[tikv] table:t3 keep order:false" + "StreamAgg_20 1.00 99.31 root funcs:count(Column#9)->Column#4", + "└─TableReader_21 1.00 49.41 root data:StreamAgg_8", + " └─StreamAgg_8 1.00 709.52 cop[tikv] funcs:count(1)->Column#9", + " └─TableFullScan_18 3.00 559.82 cop[tikv] table:t3 keep order:false" ] }, { "SQL": "explain format = 'verbose' select count(*) from t2", "Plan": [ - "StreamAgg_26 1.00 8.18 root funcs:count(Column#7)->Column#4", - "└─TableReader_27 1.00 5.17 root data:StreamAgg_10", - " └─StreamAgg_10 1.00 49.50 batchCop[tiflash] funcs:count(1)->Column#7", - " └─TableFullScan_25 3.00 40.50 batchCop[tiflash] table:t2 keep order:false" + "StreamAgg_26 1.00 99.31 root funcs:count(Column#7)->Column#4", + "└─TableReader_27 1.00 49.41 root data:StreamAgg_10", + " └─StreamAgg_10 1.00 709.52 cop[tikv] funcs:count(1)->Column#7", + " └─TableFullScan_24 3.00 559.82 cop[tikv] table:t2 keep order:false" ] }, { "SQL": "explain format = 'verbose' select * from t3 order by a", "Plan": [ - "Sort_4 3.00 45.85 root test.t3.a", - "└─TableReader_8 3.00 11.78 root data:TableFullScan_7", - " └─TableFullScan_7 3.00 108.00 cop[tikv] table:t3 keep order:false" + "Sort_4 3.00 309.53 root test.t3.a", + "└─TableReader_8 3.00 62.67 root data:TableFullScan_7", + " └─TableFullScan_7 3.00 559.82 cop[tikv] table:t3 keep order:false" ] }, { "SQL": "explain format = 'verbose' select * from t3 order by b", "Plan": [ - "Sort_4 3.00 45.85 root test.t3.b", - "└─TableReader_8 3.00 11.78 root data:TableFullScan_7", - " └─TableFullScan_7 3.00 108.00 cop[tikv] table:t3 keep order:false" + "Sort_4 3.00 309.53 root test.t3.b", + "└─TableReader_8 3.00 62.67 root data:TableFullScan_7", + " └─TableFullScan_7 3.00 559.82 cop[tikv] table:t3 keep order:false" ] }, { "SQL": "explain format = 'verbose' select * from t3 order by a limit 1", "Plan": [ - "TopN_7 1.00 13.22 root test.t3.a, offset:0, count:1", - "└─TableReader_16 1.00 10.22 root data:TopN_15", - " └─TopN_15 1.00 117.00 cop[tikv] test.t3.a, offset:0, count:1", - " └─TableFullScan_14 3.00 108.00 cop[tikv] table:t3 keep order:false" + "TopN_7 1.00 44.96 root test.t3.a, offset:0, count:1", + "└─TableReader_16 1.00 41.76 root data:TopN_15", + " └─TopN_15 1.00 563.02 cop[tikv] test.t3.a, offset:0, count:1", + " └─TableFullScan_14 3.00 559.82 cop[tikv] table:t3 keep order:false" ] }, { "SQL": "explain format = 'verbose' select * from t3 order by b limit 1", "Plan": [ - "TopN_7 1.00 13.22 root test.t3.b, offset:0, count:1", - "└─TableReader_16 1.00 10.22 root data:TopN_15", - " └─TopN_15 1.00 117.00 cop[tikv] test.t3.b, offset:0, count:1", - " └─TableFullScan_14 3.00 108.00 cop[tikv] table:t3 keep order:false" + "TopN_7 1.00 44.96 root test.t3.b, offset:0, count:1", + "└─TableReader_16 1.00 41.76 root data:TopN_15", + " └─TopN_15 1.00 563.02 cop[tikv] test.t3.b, offset:0, count:1", + " └─TableFullScan_14 3.00 559.82 cop[tikv] table:t3 keep order:false" ] }, { "SQL": "explain format = 'verbose' select count(*) from t2 group by a", "Plan": [ - "TableReader_44 3.00 4.98 root data:ExchangeSender_43", - "└─ExchangeSender_43 3.00 96.60 mpp[tiflash] ExchangeType: PassThrough", - " └─Projection_38 3.00 76.80 mpp[tiflash] Column#4", - " └─HashAgg_36 3.00 57.00 mpp[tiflash] group by:test.t2.a, funcs:count(1)->Column#4", - " └─ExchangeReceiver_22 3.00 48.00 mpp[tiflash] ", - " └─ExchangeSender_21 3.00 45.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.t2.a, collate: binary]", - " └─TableFullScan_20 3.00 45.00 mpp[tiflash] table:t2 keep order:false" + "TableReader_25 3.00 25896.21 root data:ExchangeSender_24", + "└─ExchangeSender_24 3.00 388390.38 mpp[tiflash] ExchangeType: PassThrough", + " └─Projection_23 3.00 388390.38 mpp[tiflash] Column#4", + " └─HashAgg_9 3.00 388390.38 mpp[tiflash] group by:test.t2.a, funcs:count(1)->Column#4", + " └─ExchangeReceiver_22 3.00 385507.26 mpp[tiflash] ", + " └─ExchangeSender_21 3.00 385459.26 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.t2.a, collate: binary]", + " └─TableFullScan_20 3.00 385459.26 mpp[tiflash] table:t2 keep order:false" ] }, { "SQL": "explain format = 'verbose' select count(*) from t3 where b = 0", "Plan": [ - "StreamAgg_10 1.00 1.33 root funcs:count(1)->Column#4", - "└─IndexReader_15 0.00 1.33 root index:IndexRangeScan_14", + "StreamAgg_10 1.00 0.00 root funcs:count(1)->Column#4", + "└─IndexReader_15 0.00 0.00 root index:IndexRangeScan_14", " └─IndexRangeScan_14 0.00 0.00 cop[tikv] table:t3, index:c(b) range:[0,0], keep order:false" ] }, { "SQL": "explain format = 'verbose' select /*+ use_index(t3, c) */ count(a) from t3 where b = 0", "Plan": [ - "StreamAgg_10 1.00 19.33 root funcs:count(test.t3.a)->Column#4", - "└─IndexLookUp_17 0.00 19.33 root ", + "StreamAgg_10 1.00 0.00 root funcs:count(test.t3.a)->Column#4", + "└─IndexLookUp_17 0.00 0.00 root ", " ├─IndexRangeScan_15(Build) 0.00 0.00 cop[tikv] table:t3, index:c(b) range:[0,0], keep order:false", " └─TableRowIDScan_16(Probe) 0.00 0.00 cop[tikv] table:t3 keep order:false" ] @@ -2566,91 +2566,90 @@ { "SQL": "explain format = 'verbose' select count(*) from t2 where a = 0", "Plan": [ - "StreamAgg_12 1.00 4.93 root funcs:count(1)->Column#4", - "└─TableReader_24 0.00 4.93 root data:Selection_23", - " └─Selection_23 0.00 54.00 cop[tiflash] eq(test.t2.a, 0)", - " └─TableFullScan_22 3.00 45.00 cop[tiflash] table:t2 keep order:false" + "StreamAgg_12 1.00 47.30 root funcs:count(1)->Column#4", + "└─TableReader_21 0.00 47.30 root data:Selection_20", + " └─Selection_20 0.00 709.52 cop[tikv] eq(test.t2.a, 0)", + " └─TableFullScan_19 3.00 559.82 cop[tikv] table:t2 keep order:false" ] }, { "SQL": "explain format = 'verbose' select count(*) from t3 t join t3 on t.a = t3.b", "Plan": [ - "StreamAgg_10 1.00 60.22 root funcs:count(1)->Column#7", - "└─HashJoin_40 3.00 51.22 root inner join, equal:[eq(test.t3.a, test.t3.b)]", - " ├─IndexReader_28(Build) 3.00 11.66 root index:IndexFullScan_27", - " │ └─IndexFullScan_27 3.00 130.50 cop[tikv] table:t3, index:c(b) keep order:false", - " └─TableReader_26(Probe) 3.00 10.76 root data:Selection_25", - " └─Selection_25 3.00 117.00 cop[tikv] not(isnull(test.t3.a))", - " └─TableFullScan_24 3.00 108.00 cop[tikv] table:t keep order:false" - ] - }, - { - "SQL": "explain format = 'verbose' select count(*) from t1 join t2 on t1.a = t2.a", - "Plan": [ - "StreamAgg_15 1.00 18.93 root funcs:count(1)->Column#7", - "└─TableReader_47 3.00 9.93 root data:ExchangeSender_46", - " └─ExchangeSender_46 3.00 195.38 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin_43 3.00 195.38 mpp[tiflash] inner join, equal:[eq(test.t1.a, test.t2.a)]", - " ├─ExchangeReceiver_22(Build) 3.00 57.00 mpp[tiflash] ", - " │ └─ExchangeSender_21 3.00 54.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection_20 3.00 54.00 mpp[tiflash] not(isnull(test.t1.a))", - " │ └─TableFullScan_19 3.00 45.00 mpp[tiflash] table:t1 keep order:false", - " └─Selection_24(Probe) 3.00 54.00 mpp[tiflash] not(isnull(test.t2.a))", - " └─TableFullScan_23 3.00 45.00 mpp[tiflash] table:t2 keep order:false" - ] - }, - { - "SQL": "explain format = 'verbose' select count(*) from t1 join t2 on t1.a = t2.a join t3 on t1.b = t3.b", - "Plan": [ - "StreamAgg_15 1.00 60.60 root funcs:count(1)->Column#10", - "└─HashJoin_65 3.00 51.60 root inner join, equal:[eq(test.t1.b, test.t3.b)]", - " ├─IndexReader_53(Build) 3.00 11.66 root index:IndexFullScan_52", - " │ └─IndexFullScan_52 3.00 130.50 cop[tikv] table:t3, index:c(b) keep order:false", - " └─TableReader_39(Probe) 3.00 11.14 root data:ExchangeSender_38", - " └─ExchangeSender_38 3.00 204.38 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin_29 3.00 204.38 mpp[tiflash] inner join, equal:[eq(test.t1.a, test.t2.a)]", - " ├─ExchangeReceiver_35(Build) 3.00 66.00 mpp[tiflash] ", - " │ └─ExchangeSender_34 3.00 63.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection_33 3.00 63.00 mpp[tiflash] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - " │ └─TableFullScan_32 3.00 54.00 mpp[tiflash] table:t1 keep order:false", - " └─Selection_37(Probe) 3.00 54.00 mpp[tiflash] not(isnull(test.t2.a))", - " └─TableFullScan_36 3.00 45.00 mpp[tiflash] table:t2 keep order:false" - ] - }, - { - "SQL": "explain format = 'verbose' select (2) in (select count(*) from t1) from (select t.b < (select t.b from t2 limit 1 ) from t3 t) t", - "Plan": [ - "HashJoin_19 3.00 127.40 root CARTESIAN left outer semi join", - "├─Selection_39(Build) 0.80 11.18 root eq(2, Column#18)", - "│ └─StreamAgg_61 1.00 8.18 root funcs:count(Column#32)->Column#18", - "│ └─TableReader_62 1.00 5.17 root data:StreamAgg_45", - "│ └─StreamAgg_45 1.00 49.50 batchCop[tiflash] funcs:count(1)->Column#32", - "│ └─TableFullScan_60 3.00 40.50 batchCop[tiflash] table:t1 keep order:false", - "└─Projection_20(Probe) 3.00 95.82 root 1->Column#28", - " └─Apply_22 3.00 76.02 root CARTESIAN left outer join", - " ├─TableReader_24(Build) 3.00 10.16 root data:TableFullScan_23", - " │ └─TableFullScan_23 3.00 108.00 cop[tikv] table:t keep order:false", - " └─Projection_27(Probe) 3.00 21.95 root 1->Column#26", - " └─Limit_30 3.00 3.35 root offset:0, count:1", - " └─TableReader_38 3.00 3.35 root data:ExchangeSender_37", - " └─ExchangeSender_37 3.00 19.50 mpp[tiflash] ExchangeType: PassThrough", - " └─Limit_36 3.00 19.50 mpp[tiflash] offset:0, count:1", - " └─TableFullScan_35 3.00 19.50 mpp[tiflash] table:t2 keep order:false" - ] - }, - { - "SQL": "explain format = 'verbose' select /*+ merge_join(t1) */ count(*) from t1 join t2 on t1.a = t2.a", - "Plan": [ - "StreamAgg_14 1.00 59.65 root funcs:count(1)->Column#7", - "└─MergeJoin_32 3.00 50.65 root inner join, left key:test.t1.a, right key:test.t2.a", - " ├─Sort_30(Build) 3.00 20.83 root test.t2.a", - " │ └─TableReader_29 3.00 6.56 root data:Selection_28", - " │ └─Selection_28 3.00 54.00 cop[tiflash] not(isnull(test.t2.a))", - " │ └─TableFullScan_27 3.00 45.00 cop[tiflash] table:t2 keep order:false", - " └─Sort_23(Probe) 3.00 20.83 root test.t1.a", - " └─TableReader_22 3.00 6.56 root data:Selection_21", - " └─Selection_21 3.00 54.00 cop[tiflash] not(isnull(test.t1.a))", - " └─TableFullScan_20 3.00 45.00 cop[tiflash] table:t1 keep order:false" + "StreamAgg_10 1.00 630.77 root funcs:count(1)->Column#7", + "└─HashJoin_40 3.00 481.07 root inner join, equal:[eq(test.t3.a, test.t3.b)]", + " ├─IndexReader_28(Build) 3.00 52.22 root index:IndexFullScan_27", + " │ └─IndexFullScan_27 3.00 593.16 cop[tikv] table:t3, index:c(b) keep order:false", + " └─TableReader_26(Probe) 3.00 59.97 root data:Selection_25", + " └─Selection_25 3.00 709.52 cop[tikv] not(isnull(test.t3.a))", + " └─TableFullScan_24 3.00 559.82 cop[tikv] table:t keep order:false" + ] + }, + { + "SQL": "explain format = 'verbose' select /*+ read_from_storage(tiflash[t1, t2]) */ count(*) from t1 join t2 on t1.a = t2.a", + "Plan": [ + "StreamAgg_15 1.00 51562.56 root funcs:count(1)->Column#7", + "└─TableReader_41 3.00 51412.86 root data:ExchangeSender_40", + " └─ExchangeSender_40 3.00 771087.32 mpp[tiflash] ExchangeType: PassThrough", + " └─HashJoin_37 3.00 771087.32 mpp[tiflash] inner join, equal:[eq(test.t1.a, test.t2.a)]", + " ├─ExchangeReceiver_22(Build) 3.00 385610.46 mpp[tiflash] ", + " │ └─ExchangeSender_21 3.00 385466.46 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection_20 3.00 385466.46 mpp[tiflash] not(isnull(test.t1.a))", + " │ └─TableFullScan_19 3.00 385459.26 mpp[tiflash] table:t1 keep order:false", + " └─Selection_24(Probe) 3.00 385466.46 mpp[tiflash] not(isnull(test.t2.a))", + " └─TableFullScan_23 3.00 385459.26 mpp[tiflash] table:t2 keep order:false" + ] + }, + { + "SQL": "explain format = 'verbose' select /*+ read_from_storage(tiflash[t1, t2]) */ count(*) from t1 join t2 on t1.a = t2.a join t3 on t1.b = t3.b", + "Plan": [ + "StreamAgg_15 1.00 54032.05 root funcs:count(1)->Column#10", + "└─HashJoin_59 3.00 53882.35 root inner join, equal:[eq(test.t1.b, test.t3.b)]", + " ├─IndexReader_47(Build) 3.00 52.22 root index:IndexFullScan_46", + " │ └─IndexFullScan_46 3.00 593.16 cop[tikv] table:t3, index:c(b) keep order:false", + " └─TableReader_39(Probe) 3.00 53461.26 root data:ExchangeSender_38", + " └─ExchangeSender_38 3.00 801760.47 mpp[tiflash] ExchangeType: PassThrough", + " └─HashJoin_29 3.00 801760.47 mpp[tiflash] inner join, equal:[eq(test.t1.a, test.t2.a)]", + " ├─ExchangeReceiver_35(Build) 3.00 416282.81 mpp[tiflash] ", + " │ └─ExchangeSender_34 3.00 415994.81 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection_33 3.00 415994.81 mpp[tiflash] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ └─TableFullScan_32 3.00 415980.41 mpp[tiflash] table:t1 keep order:false", + " └─Selection_37(Probe) 3.00 385466.46 mpp[tiflash] not(isnull(test.t2.a))", + " └─TableFullScan_36 3.00 385459.26 mpp[tiflash] table:t2 keep order:false" + ] + }, + { + "SQL": "explain format = 'verbose' select /*+ read_from_storage(tiflash[t1, t2]) */ (2) in (select count(*) from t1) from (select t.b < (select t.b from t2 limit 1 ) from t3 t) t", + "Plan": [ + "HashJoin_19 3.00 326.68 root CARTESIAN left outer semi join", + "├─Selection_39(Build) 0.80 149.21 root eq(2, Column#18)", + "│ └─StreamAgg_61 1.00 99.31 root funcs:count(Column#32)->Column#18", + "│ └─TableReader_62 1.00 49.41 root data:StreamAgg_45", + "│ └─StreamAgg_45 1.00 709.52 cop[tikv] funcs:count(1)->Column#32", + "│ └─TableFullScan_59 3.00 559.82 cop[tikv] table:t1 keep order:false", + "└─Projection_20(Probe) 3.00 106.32 root 1->Column#28", + " └─Apply_22 3.00 106.32 root CARTESIAN left outer join", + " ├─TableReader_24(Build) 3.00 49.99 root data:TableFullScan_23", + " │ └─TableFullScan_23 3.00 559.82 cop[tikv] table:t keep order:false", + " └─Projection_27(Probe) 3.00 18.78 root 1->Column#26", + " └─Limit_28 3.00 18.78 root offset:0, count:1", + " └─TableReader_34 3.00 18.78 root data:Limit_33", + " └─Limit_33 3.00 186.61 cop[tikv] offset:0, count:1", + " └─TableFullScan_31 3.00 186.61 cop[tikv] table:t2 keep order:false" + ] + }, + { + "SQL": "explain format = 'verbose' select /*+ merge_join(t1), read_from_storage(tiflash[t1, t2]) */ count(*) from t1 join t2 on t1.a = t2.a", + "Plan": [ + "StreamAgg_14 1.00 52064.31 root funcs:count(1)->Column#7", + "└─MergeJoin_26 3.00 51914.61 root inner join, left key:test.t1.a, right key:test.t2.a", + " ├─Sort_24(Build) 3.00 25957.31 root test.t2.a", + " │ └─TableReader_23 3.00 25710.44 root data:Selection_22", + " │ └─Selection_22 3.00 385466.46 cop[tiflash] not(isnull(test.t2.a))", + " │ └─TableFullScan_21 3.00 385459.26 cop[tiflash] table:t2 keep order:false", + " └─Sort_20(Probe) 3.00 25957.31 root test.t1.a", + " └─TableReader_19 3.00 25710.44 root data:Selection_18", + " └─Selection_18 3.00 385466.46 cop[tiflash] not(isnull(test.t1.a))", + " └─TableFullScan_17 3.00 385459.26 cop[tiflash] table:t1 keep order:false" ] } ] From 5362285475bdbf89608d980631ed193309110ae1 Mon Sep 17 00:00:00 2001 From: qw4990 Date: Thu, 3 Nov 2022 18:07:58 +0800 Subject: [PATCH 4/6] fixup --- .../core/testdata/integration_suite_in.json | 2 +- .../core/testdata/integration_suite_out.json | 30 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/planner/core/testdata/integration_suite_in.json b/planner/core/testdata/integration_suite_in.json index 0505e7437d43b..66b6afdeb026e 100644 --- a/planner/core/testdata/integration_suite_in.json +++ b/planner/core/testdata/integration_suite_in.json @@ -470,7 +470,7 @@ "explain format = 'verbose' select count(*) from t3 t join t3 on t.a = t3.b", "explain format = 'verbose' select /*+ read_from_storage(tiflash[t1, t2]) */ count(*) from t1 join t2 on t1.a = t2.a", "explain format = 'verbose' select /*+ read_from_storage(tiflash[t1, t2]) */ count(*) from t1 join t2 on t1.a = t2.a join t3 on t1.b = t3.b", - "explain format = 'verbose' select /*+ read_from_storage(tiflash[t1, t2]) */ (2) in (select count(*) from t1) from (select t.b < (select t.b from t2 limit 1 ) from t3 t) t", + "explain format = 'verbose' select (2) in (select /*+ read_from_storage(tiflash[t1]) */ count(*) from t1) from (select t.b < (select /*+ read_from_storage(tiflash[t2]) */ t.b from t2 limit 1 ) from t3 t) t", "explain format = 'verbose' select /*+ merge_join(t1), read_from_storage(tiflash[t1, t2]) */ count(*) from t1 join t2 on t1.a = t2.a" ] diff --git a/planner/core/testdata/integration_suite_out.json b/planner/core/testdata/integration_suite_out.json index a72a818987402..b6635a1cfac75 100644 --- a/planner/core/testdata/integration_suite_out.json +++ b/planner/core/testdata/integration_suite_out.json @@ -2618,23 +2618,23 @@ ] }, { - "SQL": "explain format = 'verbose' select /*+ read_from_storage(tiflash[t1, t2]) */ (2) in (select count(*) from t1) from (select t.b < (select t.b from t2 limit 1 ) from t3 t) t", - "Plan": [ - "HashJoin_19 3.00 326.68 root CARTESIAN left outer semi join", - "├─Selection_39(Build) 0.80 149.21 root eq(2, Column#18)", - "│ └─StreamAgg_61 1.00 99.31 root funcs:count(Column#32)->Column#18", - "│ └─TableReader_62 1.00 49.41 root data:StreamAgg_45", - "│ └─StreamAgg_45 1.00 709.52 cop[tikv] funcs:count(1)->Column#32", - "│ └─TableFullScan_59 3.00 559.82 cop[tikv] table:t1 keep order:false", - "└─Projection_20(Probe) 3.00 106.32 root 1->Column#28", - " └─Apply_22 3.00 106.32 root CARTESIAN left outer join", + "SQL": "explain format = 'verbose' select (2) in (select /*+ read_from_storage(tiflash[t1]) */ count(*) from t1) from (select t.b < (select /*+ read_from_storage(tiflash[t2]) */ t.b from t2 limit 1 ) from t3 t) t", + "Plan": [ + "HashJoin_19 3.00 110724.19 root CARTESIAN left outer semi join", + "├─Selection_38(Build) 0.80 24733.71 root eq(2, Column#18)", + "│ └─StreamAgg_45 1.00 24683.81 root funcs:count(1)->Column#18", + "│ └─TableReader_59 3.00 24534.11 root data:TableFullScan_58", + "│ └─TableFullScan_58 3.00 367821.61 cop[tiflash] table:t1 keep order:false", + "└─Projection_20(Probe) 3.00 85919.34 root 1->Column#28", + " └─Apply_22 3.00 85919.34 root CARTESIAN left outer join", " ├─TableReader_24(Build) 3.00 49.99 root data:TableFullScan_23", " │ └─TableFullScan_23 3.00 559.82 cop[tikv] table:t keep order:false", - " └─Projection_27(Probe) 3.00 18.78 root 1->Column#26", - " └─Limit_28 3.00 18.78 root offset:0, count:1", - " └─TableReader_34 3.00 18.78 root data:Limit_33", - " └─Limit_33 3.00 186.61 cop[tikv] offset:0, count:1", - " └─TableFullScan_31 3.00 186.61 cop[tikv] table:t2 keep order:false" + " └─Projection_27(Probe) 3.00 28623.12 root 1->Column#26", + " └─Limit_30 3.00 28623.12 root offset:0, count:1", + " └─TableReader_37 3.00 28623.12 root data:ExchangeSender_36", + " └─ExchangeSender_36 3.00 429293.93 mpp[tiflash] ExchangeType: PassThrough", + " └─Limit_35 3.00 429293.93 mpp[tiflash] offset:0, count:1", + " └─TableFullScan_34 3.00 429293.93 mpp[tiflash] table:t2 keep order:false" ] }, { From d443761abd0a63f72c4731467378e52aed1d803c Mon Sep 17 00:00:00 2001 From: qw4990 Date: Thu, 3 Nov 2022 18:36:39 +0800 Subject: [PATCH 5/6] fixup --- planner/core/testdata/analyze_suite_out.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/planner/core/testdata/analyze_suite_out.json b/planner/core/testdata/analyze_suite_out.json index 68d5acacc0ec9..d9345a1a5bcce 100644 --- a/planner/core/testdata/analyze_suite_out.json +++ b/planner/core/testdata/analyze_suite_out.json @@ -45,10 +45,9 @@ { "SQL": "explain format = 'brief' select count(*) from t group by a", "Plan": [ - "HashAgg 2.00 root group by:test.t.a, funcs:count(Column#4)->Column#3", - "└─TableReader 2.00 root data:HashAgg", - " └─HashAgg 2.00 cop[tikv] group by:test.t.a, funcs:count(1)->Column#4", - " └─TableFullScan 8.00 cop[tikv] table:t keep order:false" + "HashAgg 2.00 root group by:test.t.a, funcs:count(1)->Column#3", + "└─TableReader 8.00 root data:TableFullScan", + " └─TableFullScan 8.00 cop[tikv] table:t keep order:false" ] } ] From 69fec6f27a91f60dd065e8922854f55f936bbd5c Mon Sep 17 00:00:00 2001 From: qw4990 Date: Thu, 3 Nov 2022 18:40:01 +0800 Subject: [PATCH 6/6] fixup --- executor/join_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/executor/join_test.go b/executor/join_test.go index 2e402308e6c25..d5285162bdff4 100644 --- a/executor/join_test.go +++ b/executor/join_test.go @@ -1357,7 +1357,7 @@ func TestIndexLookupJoin(t *testing.T) { tk.MustExec("analyze table s;") tk.MustQuery("desc format = 'brief' select /*+ TIDB_INLJ(s) */ count(*) from t join s use index(idx) on s.a = t.a and s.b < t.b").Check(testkit.Rows( - "HashAgg 1.00 root funcs:count(1)->Column#6", + "StreamAgg 1.00 root funcs:count(1)->Column#6", "└─IndexJoin 64.00 root inner join, inner:IndexReader, outer key:test.t.a, inner key:test.s.a, equal cond:eq(test.t.a, test.s.a), other cond:lt(test.s.b, test.t.b)", " ├─TableReader(Build) 64.00 root data:Selection", " │ └─Selection 64.00 cop[tikv] not(isnull(test.t.b))", @@ -1370,7 +1370,7 @@ func TestIndexLookupJoin(t *testing.T) { tk.MustQuery("select /*+ TIDB_INLJ(s) */ count(*) from t join s use index(idx) on s.a = t.a and s.b < t.b").Check(testkit.Rows("64")) tk.MustQuery("desc format = 'brief' select /*+ INL_MERGE_JOIN(s) */ count(*) from t join s use index(idx) on s.a = t.a and s.b < t.b").Check(testkit.Rows( - "HashAgg 1.00 root funcs:count(1)->Column#6", + "StreamAgg 1.00 root funcs:count(1)->Column#6", "└─IndexMergeJoin 64.00 root inner join, inner:IndexReader, outer key:test.t.a, inner key:test.s.a, other cond:lt(test.s.b, test.t.b)", " ├─TableReader(Build) 64.00 root data:Selection", " │ └─Selection 64.00 cop[tikv] not(isnull(test.t.b))", @@ -1384,7 +1384,7 @@ func TestIndexLookupJoin(t *testing.T) { tk.MustQuery("select /*+ INL_MERGE_JOIN(s) */ count(*) from t join s use index(idx) on s.a = t.a and s.b < t.b").Check(testkit.Rows("64")) tk.MustQuery("desc format = 'brief' select /*+ INL_HASH_JOIN(s) */ count(*) from t join s use index(idx) on s.a = t.a and s.b < t.b").Check(testkit.Rows( - "HashAgg 1.00 root funcs:count(1)->Column#6", + "StreamAgg 1.00 root funcs:count(1)->Column#6", "└─IndexHashJoin 64.00 root inner join, inner:IndexReader, outer key:test.t.a, inner key:test.s.a, equal cond:eq(test.t.a, test.s.a), other cond:lt(test.s.b, test.t.b)", " ├─TableReader(Build) 64.00 root data:Selection", " │ └─Selection 64.00 cop[tikv] not(isnull(test.t.b))",