Unexpected Estimated Rows of `OR`
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
The number of Estimated Rows in the query plan is unexpected.
### 1. Minimal reproduce step (Required)
```sql
CREATE TABLE t0(c0 INT);
INSERT INTO t0 VALUES(0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
ANALYZE TABLE t0;
EXPLAIN SELECT * FROM t0 WHERE TRUE; -- estimated rows: 10.00
EXPLAIN SELECT * FROM t0 WHERE (TRUE)OR(TO_BASE64(t0.c0)); -- estimated rows: 8.00
```
### 2. What did you expect to see? (Required)
The estimated rows of the second `SELECT` should be 10.0.
### 3. What did you see instead (Required)
The estimated rows of the second `SELECT` is 8.0.
As a reference, this result is expected if another expression is used as the right operand of the `OR`:
```sql
EXPLAIN SELECT * FROM t0 WHERE (TRUE)OR((t0.c0>0); -- estimated rows: 10.00
```
### 4. What is your TiDB version? (Required)
```
| Release Version: v6.4.0-alpha-12-g51a6684fb
Edition: Community
Git Commit Hash: 51a6684fb767cfd86a8312e0e6447963b927c791
Git Branch: master
UTC Build Time: 2022-10-05 12:40:23
GoVersion: go1.19.1
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: unistore |
```
Contributor guide
Assessment
This issue has not been assessed yet.