cannot deduce TableDual when the partition key does not meet the conditions
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```
create table t(a int primary key, b int);
create table tlist (a int) partition by list (a) (
partition p0 values in (0, 1, 2),
partition p1 values in (3, 4, 5),
partition p2 values in (6, 7, 8),
partition p3 values in (9, 10, 11));
explain select 1 from t left join tlist on tlist.a=t.a where t.a in (12, 13);
```
### 2. What did you expect to see? (Required)
v7.5
```
+-------------------------------+---------+------+---------------+-----------------------------------------------------+
| id | estRows | task | access object | operator info |
+-------------------------------+---------+------+---------------+-----------------------------------------------------+
| Projection_8 | 2.00 | root | | 1->Column#5 |
| └─HashJoin_9 | 2.00 | root | | left outer join, equal:[eq(test.t.a, test.tlist.a)] |
| ├─TableDual_12(Build) | 0.00 | root | | rows:0 |
| └─Batch_Point_Get_11(Probe) | 2.00 | root | table:t | handle:[12 13], keep order:false, desc:false |
+-------------------------------+---------+------+---------------+-----------------------------------------------------+
```
### 3. What did you see instead (Required)
v8.1
```
+-------------------------------+----------+-----------+----------------+-----------------------------------------------------+
| id | estRows | task | access object | operator info |
+-------------------------------+----------+-----------+----------------+-----------------------------------------------------+
| Projection_7 | 2.50 | root | | 1->Column#5 |
| └─HashJoin_9 | 2.50 | root | | left outer join, equal:[eq(test.t.a, test.tlist.a)] |
| ├─Batch_Point_Get_10(Build) | 2.00 | root | table:t | handle:[12 13], keep order:false, desc:false |
| └─TableReader_13(Probe) | 20.00 | root | partition:dual | data:Selection_12 |
| └─Selection_12 | 20.00 | cop[tikv] | | in(test.tlist.a, 12, 13), not(isnull(test.tlist.a)) |
| └─TableFullScan_11 | 10000.00 | cop[tikv] | table:tlist | keep order:false, stats:pseudo |
+-------------------------------+----------+-----------+----------------+-----------------------------------------------------+
```
if you get dual partition, we should get 1 row count.
### 4. What is your TiDB version? (Required)
Contributor guide
Assessment
This issue has not been assessed yet.