* planner: make some access paths check fit the clustered index * add test * add test for outer join elimination * make test stable * fix test Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
77 lines
2.6 KiB
JSON
77 lines
2.6 KiB
JSON
[
|
|
{
|
|
"Name": "TestClusterIndexCBOPointGet",
|
|
"Cases": [
|
|
{
|
|
"SQL": "select * from t1 where a = 1 and b = 1 and c = 1",
|
|
"Plan": [
|
|
"Selection_6 0.00 root eq(test.t1.c, 1)",
|
|
"└─Point_Get_5 1.00 root table:t1, index:PRIMARY(a, b) "
|
|
],
|
|
"Res": [
|
|
"1 1 1"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 where t2.a = '111' and t2.b = 1",
|
|
"Plan": [
|
|
"Selection_6 0.00 root eq(test.t2.b, 1)",
|
|
"└─Point_Get_5 1.00 root table:t2, index:PRIMARY(a) "
|
|
],
|
|
"Res": [
|
|
"111 1"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 join t2 on t1.a = t2.b where t1.a = 1",
|
|
"Plan": [
|
|
"Projection_7 10.00 root test.t1.a, test.t1.b, test.t1.c, test.t2.a, test.t2.b",
|
|
"└─HashJoin_9 10.00 root CARTESIAN inner join",
|
|
" ├─Point_Get_10(Build) 1.00 root table:t2, index:b(b) ",
|
|
" └─TableReader_12(Probe) 10.00 root data:TableRangeScan_11",
|
|
" └─TableRangeScan_11 10.00 cop[tikv] table:t1 range:[1,1], keep order:false, stats:pseudo"
|
|
],
|
|
"Res": [
|
|
"1 1 1 111 1"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where (a,b) in ((1,1),(2,2)) and c = 2",
|
|
"Plan": [
|
|
"TableReader_7 8.00 root data:Selection_6",
|
|
"└─Selection_6 8.00 cop[tikv] eq(test.t1.c, 2), or(and(eq(test.t1.a, 1), eq(test.t1.b, 1)), and(eq(test.t1.a, 2), eq(test.t1.b, 2)))",
|
|
" └─TableRangeScan_5 20.00 cop[tikv] table:t1 range:[1,1], [2,2], keep order:false, stats:pseudo"
|
|
],
|
|
"Res": [
|
|
"2 2 2"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 where a in ('111','222') and b = 2",
|
|
"Plan": [
|
|
"Selection_6 0.00 root eq(test.t2.b, 2)",
|
|
"└─Batch_Point_Get_5 0.00 root table:t2, index:PRIMARY(a) keep order:false, desc:false"
|
|
],
|
|
"Res": [
|
|
"222 2"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 where a in ('111','222') union all select a,c from t1 where (a,b) in ((1,1),(2,2))",
|
|
"Plan": [
|
|
"Union_10 8020.00 root ",
|
|
"├─Batch_Point_Get_12 2.00 root table:t2, index:PRIMARY(a) keep order:false, desc:false",
|
|
"└─Projection_13 8000.00 root cast(test.t1.a, varchar(20) BINARY CHARACTER SET utf8mb4 COLLATE utf8mb4_bin)->Column#6, test.t1.c",
|
|
" └─Batch_Point_Get_14 2.00 root table:t1, index:PRIMARY(a, b) keep order:false, desc:false"
|
|
],
|
|
"Res": [
|
|
"1 1",
|
|
"111 1",
|
|
"2 2",
|
|
"222 2"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|