Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

planner: enable fix control for enforced | tidb-test=pr/2404 #56414

Merged
merged 32 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c8c92c3
testcase10
terry1purcell Sep 22, 2024
515e929
planner: remove fix control 46177
terry1purcell Sep 29, 2024
436a82f
testcase1
terry1purcell Sep 29, 2024
3d8ca9c
Merge branch 'pingcap:master' into enforced
terry1purcell Oct 1, 2024
61b219b
testcase new1
terry1purcell Oct 1, 2024
fa1bc43
testcase new2
terry1purcell Oct 2, 2024
92f5cd9
testcase new3
terry1purcell Oct 2, 2024
10cf646
testcase new4
terry1purcell Oct 2, 2024
779f4e5
testcase new5
terry1purcell Oct 2, 2024
6ea7992
testcase new6
terry1purcell Oct 3, 2024
980d725
revert2
terry1purcell Oct 7, 2024
7379c37
Merge branch 'pingcap:master' into enforced
terry1purcell Oct 15, 2024
df26bc7
comment change1
terry1purcell Oct 15, 2024
5b866fd
new testcase1
terry1purcell Oct 15, 2024
cf0a8b4
new testcase2
terry1purcell Oct 15, 2024
4de1f9a
Merge branch 'pingcap:master' into enforced
terry1purcell Oct 15, 2024
8e27d24
new testcase3
terry1purcell Oct 15, 2024
816280e
new testcase4
terry1purcell Oct 16, 2024
64c2488
new testcase5
terry1purcell Oct 16, 2024
b2a99e3
new testcase6
terry1purcell Oct 16, 2024
070f975
new testcase7
terry1purcell Oct 16, 2024
f31bdbc
Merge branch 'pingcap:master' into enforced
terry1purcell Oct 20, 2024
d5a02f1
new testcase8
terry1purcell Oct 20, 2024
b1ffeee
new testcase9
terry1purcell Oct 20, 2024
228b43e
new testcase10
terry1purcell Oct 20, 2024
7fa4bdd
new testcase11
terry1purcell Oct 22, 2024
de1e807
Merge branch 'pingcap:master' into enforced
terry1purcell Oct 22, 2024
e79fcac
rebase
terry1purcell Oct 22, 2024
e5c3123
Merge branch 'pingcap:master' into enforced
terry1purcell Oct 22, 2024
2b3849b
test after rebase
terry1purcell Oct 22, 2024
2792500
test2 after rebase
terry1purcell Oct 22, 2024
4bae7a9
test3 after rebase
terry1purcell Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions pkg/executor/test/cte/cte_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,14 @@ func TestCTEIterationMemTracker(t *testing.T) {
tk.MustQuery(fmt.Sprintf("explain analyze with recursive cte1 as (select c1 from t1 union all select c1 + 1 c1 from cte1 where c1 < %d) select * from cte1", maxIter))
}

func TestCTETableInvaildTask(t *testing.T) {
func TestCTETableInvalidTask(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("CREATE TABLE p ( groupid bigint(20) DEFAULT NULL, KEY k1 (groupid));")
tk.MustExec(`CREATE TABLE g (groupid bigint(20) DEFAULT NULL,parentid bigint(20) NOT NULL,KEY k1 (parentid),KEY k2 (groupid,parentid));`)
tk.MustExec(`set tidb_opt_enable_hash_join=off;`)
tk.MustQuery(`explain WITH RECURSIVE w(gid) AS (
tk.MustQuery(`explain format='brief' WITH RECURSIVE w(gid) AS (
SELECT
groupId
FROM
Expand All @@ -261,22 +261,22 @@ WHERE
FROM
w
);`).Check(testkit.Rows(
"Projection_54 9990.00 root 1->Column#17",
"└─IndexJoin_59 9990.00 root inner join, inner:IndexReader_58, outer key:test.p.groupid, inner key:test.g.groupid, equal cond:eq(test.p.groupid, test.g.groupid)",
" ├─HashAgg_75(Build) 12800.00 root group by:test.p.groupid, funcs:firstrow(test.p.groupid)->test.p.groupid",
" │ └─Selection_72 12800.00 root not(isnull(test.p.groupid))",
" │ └─CTEFullScan_73 16000.00 root CTE:w data:CTE_0",
" └─IndexReader_58(Probe) 9990.00 root index:Selection_57",
" └─Selection_57 9990.00 cop[tikv] not(isnull(test.g.groupid))",
" └─IndexRangeScan_56 10000.00 cop[tikv] table:g, index:k2(groupid, parentid) range: decided by [eq(test.g.groupid, test.p.groupid)], keep order:false, stats:pseudo",
"Projection 9990.00 root 1->Column#17",
"└─IndexJoin 9990.00 root inner join, inner:IndexReader, outer key:test.p.groupid, inner key:test.g.groupid, equal cond:eq(test.p.groupid, test.g.groupid)",
" ├─HashAgg(Build) 12800.00 root group by:test.p.groupid, funcs:firstrow(test.p.groupid)->test.p.groupid",
" │ └─Selection 12800.00 root not(isnull(test.p.groupid))",
" │ └─CTEFullScan 16000.00 root CTE:w data:CTE_0",
" └─IndexReader(Probe) 9990.00 root index:Selection",
" └─Selection 9990.00 cop[tikv] not(isnull(test.g.groupid))",
" └─IndexRangeScan 10000.00 cop[tikv] table:g, index:k2(groupid, parentid) range: decided by [eq(test.g.groupid, test.p.groupid)], keep order:false, stats:pseudo",
"CTE_0 16000.00 root Recursive CTE",
"├─IndexReader_24(Seed Part) 10000.00 root index:IndexFullScan_23",
"│ └─IndexFullScan_23 10000.00 cop[tikv] table:p, index:k1(groupid) keep order:false, stats:pseudo",
"└─IndexHashJoin_34(Recursive Part) 10000.00 root inner join, inner:IndexLookUp_31, outer key:test.p.groupid, inner key:test.g.parentid, equal cond:eq(test.p.groupid, test.g.parentid)",
" ├─Selection_51(Build) 8000.00 root not(isnull(test.p.groupid))",
" │ └─CTETable_52 10000.00 root Scan on CTE_0",
" └─IndexLookUp_31(Probe) 10000.00 root ",
" ├─IndexRangeScan_29(Build) 10000.00 cop[tikv] table:g, index:k1(parentid) range: decided by [eq(test.g.parentid, test.p.groupid)], keep order:false, stats:pseudo",
" └─TableRowIDScan_30(Probe) 10000.00 cop[tikv] table:g keep order:false, stats:pseudo"))
"├─IndexReader(Seed Part) 10000.00 root index:IndexFullScan",
"│ └─IndexFullScan 10000.00 cop[tikv] table:p, index:k1(groupid) keep order:false, stats:pseudo",
"└─IndexHashJoin(Recursive Part) 10000.00 root inner join, inner:IndexLookUp, outer key:test.p.groupid, inner key:test.g.parentid, equal cond:eq(test.p.groupid, test.g.parentid)",
" ├─Selection(Build) 8000.00 root not(isnull(test.p.groupid))",
" │ └─CTETable 10000.00 root Scan on CTE_0",
" └─IndexLookUp(Probe) 10000.00 root ",
" ├─IndexRangeScan(Build) 10000.00 cop[tikv] table:g, index:k1(parentid) range: decided by [eq(test.g.parentid, test.p.groupid)], keep order:false, stats:pseudo",
" └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:g keep order:false, stats:pseudo"))
tk.MustQuery(`show warnings`).Check(testkit.Rows())
}
156 changes: 72 additions & 84 deletions pkg/planner/core/casetest/hint/testdata/integration_suite_out.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1251,15 +1251,17 @@
{
"SQL": "explain select /*+ merge_join(t1, t2) */ * from t t1, t t2 where t1.a=t2.a",
"Plan": [
"MergeJoin_10 12487.50 root inner join, left key:test.t.a, right key:test.t.a",
"├─Projection_19(Build) 9990.00 root test.t.a, test.t.b, test.t.c",
"│ └─IndexLookUp_18 9990.00 root ",
"│ ├─IndexFullScan_16(Build) 9990.00 cop[tikv] table:t2, index:idx_a(a) keep order:true, stats:pseudo",
"│ └─TableRowIDScan_17(Probe) 9990.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
"└─Projection_15(Probe) 9990.00 root test.t.a, test.t.b, test.t.c",
" └─IndexLookUp_14 9990.00 root ",
" ├─IndexFullScan_12(Build) 9990.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo",
" └─TableRowIDScan_13(Probe) 9990.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
"MergeJoin_11 12487.50 root inner join, left key:test.t.a, right key:test.t.a",
"├─Sort_49(Build) 9990.00 root test.t.a",
"│ └─TableReader_45 9990.00 root MppVersion: 2, data:ExchangeSender_44",
"│ └─ExchangeSender_44 9990.00 mpp[tiflash] ExchangeType: PassThrough",
"│ └─Selection_43 9990.00 mpp[tiflash] not(isnull(test.t.a))",
"│ └─TableFullScan_42 10000.00 mpp[tiflash] table:t2 pushed down filter:empty, keep order:false, stats:pseudo",
"└─Sort_34(Probe) 9990.00 root test.t.a",
" └─TableReader_30 9990.00 root MppVersion: 2, data:ExchangeSender_29",
" └─ExchangeSender_29 9990.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Selection_28 9990.00 mpp[tiflash] not(isnull(test.t.a))",
" └─TableFullScan_27 10000.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
],
"Warn": [
"MPP mode may be blocked because you have used hint to specify a join algorithm which is not supported by mpp now.",
Expand Down Expand Up @@ -1289,15 +1291,17 @@
{
"SQL": "explain select /*+ merge_join(t1, t2) */ * from t t1, t t2 where t1.a=t2.a",
"Plan": [
"MergeJoin_10 12487.50 root inner join, left key:test.t.a, right key:test.t.a",
"├─Projection_19(Build) 9990.00 root test.t.a, test.t.b, test.t.c",
"│ └─IndexLookUp_18 9990.00 root ",
"│ ├─IndexFullScan_16(Build) 9990.00 cop[tikv] table:t2, index:idx_a(a) keep order:true, stats:pseudo",
"│ └─TableRowIDScan_17(Probe) 9990.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
"└─Projection_15(Probe) 9990.00 root test.t.a, test.t.b, test.t.c",
" └─IndexLookUp_14 9990.00 root ",
" ├─IndexFullScan_12(Build) 9990.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo",
" └─TableRowIDScan_13(Probe) 9990.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
"MergeJoin_11 12487.50 root inner join, left key:test.t.a, right key:test.t.a",
"├─Sort_49(Build) 9990.00 root test.t.a",
"│ └─TableReader_45 9990.00 root MppVersion: 2, data:ExchangeSender_44",
"│ └─ExchangeSender_44 9990.00 mpp[tiflash] ExchangeType: PassThrough",
"│ └─Selection_43 9990.00 mpp[tiflash] not(isnull(test.t.a))",
"│ └─TableFullScan_42 10000.00 mpp[tiflash] table:t2 pushed down filter:empty, keep order:false, stats:pseudo",
"└─Sort_34(Probe) 9990.00 root test.t.a",
" └─TableReader_30 9990.00 root MppVersion: 2, data:ExchangeSender_29",
" └─ExchangeSender_29 9990.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Selection_28 9990.00 mpp[tiflash] not(isnull(test.t.a))",
" └─TableFullScan_27 10000.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
],
"Warn": null
},
Expand Down Expand Up @@ -2701,8 +2705,8 @@
},
{
"SQL": "select /*+ MERGE_JOIN(t1) */ t1.b, t2.b from t1 inner join t2 on t1.a = t2.a;",
"Plan": "MergeInnerJoin{IndexLookUp(Index(t1.idx_a)[[-inf,+inf]], Table(t1))->Projection->IndexLookUp(Index(t2.idx_a)[[-inf,+inf]], Table(t2))->Projection}(test.t1.a,test.t2.a)",
"Hints": "merge_join(`test`.`t1`), use_index(@`sel_1` `test`.`t1` `idx_a`), order_index(@`sel_1` `test`.`t1` `idx_a`), use_index(@`sel_1` `test`.`t2` `idx_a`), order_index(@`sel_1` `test`.`t2` `idx_a`)"
"Plan": "MergeInnerJoin{TableReader(Table(t1)->Sel([not(isnull(test.t1.a))]))->Sort->TableReader(Table(t2)->Sel([not(isnull(test.t2.a))]))->Sort}(test.t1.a,test.t2.a)",
"Hints": "merge_join(`test`.`t1`), use_index(@`sel_1` `test`.`t1` ), use_index(@`sel_1` `test`.`t2` )"
}
]
},
Expand Down
Loading