Files
tidb/expression/testdata/partition_pruner_out.json

108 lines
4.6 KiB
JSON

[
{
"Name": "TestHashPartitionPruner",
"Cases": [
{
"SQL": "explain select * from t1 where id = 7 and a = 6",
"Result": [
"TableReader_8 0.00 root data:Selection_7",
"└─Selection_7 0.00 cop[tikv] eq(test_partition.t1.a, 6)",
" └─TableScan_6 1.00 cop[tikv] table:t1, partition:p7, range:[7,7], keep order:false, stats:pseudo"
]
},
{
"SQL": "explain select * from t3 where id = 9 and a = 1",
"Result": [
"Point_Get_1 1.00 root table:t3, index:id a, partition:p9"
]
},
{
"SQL": "explain select * from t2 where id = 9 and a = -110",
"Result": [
"IndexLookUp_8 1.00 root ",
"├─IndexScan_6 1.00 cop[tikv] table:t2, partition:p1, index:id, a, range:[9 -110,9 -110], keep order:false, stats:pseudo",
"└─TableScan_7 1.00 cop[tikv] table:t2, partition:p1, keep order:false, stats:pseudo"
]
},
{
"SQL": "explain select * from t1 where id = -17",
"Result": [
"TableReader_7 1.00 root data:TableScan_6",
"└─TableScan_6 1.00 cop[tikv] table:t1, partition:p7, range:[-17,-17], keep order:false, stats:pseudo"
]
},
{
"SQL": "explain select * from t2 where id = a and a = b and b = 2",
"Result": [
"TableReader_8 8.00 root data:Selection_7",
"└─Selection_7 8.00 cop[tikv] eq(test_partition.t2.a, test_partition.t2.b), eq(test_partition.t2.b, 2), eq(test_partition.t2.id, test_partition.t2.a)",
" └─TableScan_6 10000.00 cop[tikv] table:t2, partition:p4, range:[-inf,+inf], keep order:false, stats:pseudo"
]
},
{
"SQL": "explain select * from t1 join t2 on (t1.id = t2.id) where t1.id = 5 and t2.a = 7",
"Result": [
"HashLeftJoin_10 1.00 root CARTESIAN inner join, inner:IndexLookUp_16",
"├─TableReader_13 1.00 root data:TableScan_12",
"│ └─TableScan_12 1.00 cop[tikv] table:t1, partition:p5, range:[5,5], keep order:false, stats:pseudo",
"└─IndexLookUp_16 1.00 root ",
" ├─IndexScan_14 1.00 cop[tikv] table:t2, partition:p2, index:id, a, range:[5 7,5 7], keep order:false, stats:pseudo",
" └─TableScan_15 1.00 cop[tikv] table:t2, partition:p2, keep order:false, stats:pseudo"
]
},
{
"SQL": "explain select * from t1 left join t2 on t1.id = 1 and t2.a = 2 where t2.id = 7",
"Result": [
"HashLeftJoin_9 1.00 root CARTESIAN inner join, inner:IndexLookUp_15",
"├─TableReader_12 1.00 root data:TableScan_11",
"│ └─TableScan_11 1.00 cop[tikv] table:t1, partition:p1, range:[1,1], keep order:false, stats:pseudo",
"└─IndexLookUp_15 1.00 root ",
" ├─IndexScan_13 1.00 cop[tikv] table:t2, partition:p9, index:id, a, range:[7 2,7 2], keep order:false, stats:pseudo",
" └─TableScan_14 1.00 cop[tikv] table:t2, partition:p9, keep order:false, stats:pseudo"
]
},
{
"SQL": "explain select * from t2 join t1 on t1.id = t2.id and t2.a = t1.id and t2.id = 12",
"Result": [
"HashLeftJoin_9 1.00 root CARTESIAN inner join, inner:TableReader_15",
"├─IndexLookUp_13 1.00 root ",
"│ ├─IndexScan_11 1.00 cop[tikv] table:t2, partition:p4, index:id, a, range:[12 12,12 12], keep order:false, stats:pseudo",
"│ └─TableScan_12 1.00 cop[tikv] table:t2, partition:p4, keep order:false, stats:pseudo",
"└─TableReader_15 1.00 root data:TableScan_14",
" └─TableScan_14 1.00 cop[tikv] table:t1, partition:p2, range:[12,12], keep order:false, stats:pseudo"
]
},
{
"SQL": "explain select * from t1 left join t2 on true where t1.a = 1 and false",
"Result": [
"TableDual_8 0.00 root rows:0"
]
},
{
"SQL": "explain select * from t1 left join t2 on true where t1.a = 1 and null",
"Result": [
"TableDual_8 0.00 root rows:0"
]
},
{
"SQL": "explain select * from t1 left join t2 on true where t1.a = null",
"Result": [
"TableDual_8 0.00 root rows:0"
]
},
{
"SQL": "explain select * from t1 where t1.a > 7 and t1.a < 3",
"Result": [
"TableDual_6 0.00 root rows:0"
]
},
{
"SQL": "explain select * from t1 where t1.a between 7 and 3",
"Result": [
"TableDual_6 0.00 root rows:0"
]
}
]
}
]