TiDB cannot simplify (i=j) OR (i IS NULL AND j IS NULL) as i <=> j
- 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)
TiDB cannot simplify (i=j) OR (i IS NULL AND j IS NULL) as i <=> j
```
CREATE TABLE test(i INTEGER, j INTEGER);
explain SELECT i FROM test WHERE (i=j) OR (i IS NULL AND j IS NULL);
```
### 2. What did you expect to see? (Required)
In duckdb
`IS NOT DISTINCT FROM ` in duckdb is the same as the mysql '<=>'
### 3. What did you see instead (Required)
```
+------------------------+---------+-----------+---------------+---------------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+------------------------+---------+-----------+---------------+---------------------------------------------------------------------------------+
| TableReader_12 | 2.60 | root | | data:Projection_6 |
| └─Projection_6 | 2.60 | cop[tikv] | | test.test.i |
| └─Selection_11 | 2.60 | cop[tikv] | | or(eq(test.test.i, test.test.j), and(isnull(test.test.i), isnull(test.test.j))) |
| └─TableFullScan_10 | 3.00 | cop[tikv] | table:test | keep order:false, stats:pseudo |
+------------------------+---------+-----------+---------------+---------------------------------------------------------------------------------+
```
### 4. What is your TiDB version? (Required)
Contributor guide
Assessment
This issue has not been assessed yet.