pingcap / pingcap/tidb

Inconsistent results after disabling predicate_push_down

Open
#57,848 0 comments 0 reactions 0 assignees View on GitHub
ai-bugfix severity/major sig/planner type/bug
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)
```sql
create table `t4` (`id` int(11),`j` json,`d` double);
insert into `t4` values (3,cast(18446744073709551615 as json),18446744073709551616.000000);
delete from mysql.opt_rule_blacklist;
admin reload opt_rule_blacklist;
select `t1`.`id`,`t2`.`id` from `t4` as `t1` join `t4` as `t2` on `t1`.`j`=`t2`.`d`;
INSERT INTO mysql.opt_rule_blacklist VALUES("predicate_push_down");
ADMIN reload opt_rule_blacklist;
select `t1`.`id`,`t2`.`id` from `t4` as `t1` join `t4` as `t2` on `t1`.`j`=`t2`.`d`;
```

### 2. What did you expect to see? (Required)

Queries return same result.

### 3. What did you see instead (Required)

```sql
mysql> delete from mysql.opt_rule_blacklist;
Query OK, 0 rows affected (0.01 sec)

mysql> admin reload opt_rule_blacklist;
Query OK, 0 rows affected (0.00 sec)

mysql> select `t1`.`id`,`t2`.`id` from `t4` as `t1` join `t4` as `t2` on `t1`.`j`=`t2`.`d`;
Empty set (0.01 sec)

mysql> INSERT INTO mysql.opt_rule_blacklist VALUES("predicate_push_down");
Query OK, 1 row affected (0.01 sec)

mysql> ADMIN reload opt_rule_blacklist;
Query OK, 0 rows affected (0.00 sec)

mysql> select `t1`.`id`,`t2`.`id` from `t4` as `t1` join `t4` as `t2` on `t1`.`j`=`t2`.`d`;
+------+------+
| id | id |
+------+------+
| 3 | 3 |
+------+------+
1 row in set (0.01 sec)
```
Also, executing the query in MySQL returns the second result

### 4. What is your TiDB version? (Required)
```sql
Release Version: v8.5.0-alpha-79-g426ce3e570
Edition: Community
Git Commit Hash: 426ce3e57069afbd8f061d7ae39c79d3f9e2ff5d
Git Branch: master
UTC Build Time: 2024-11-09 12:25:03
GoVersion: go1.23.0
Race Enabled: false
Check Table Before Drop: false
Store: tikv
```

Contributor guide

Open the contributing guide

Research direction

Run the provided SQL reproduction against the listed TiDB version, comparing results with predicate_push_down enabled and blacklisted. Start by tracing the opt_rule_blacklist handling and predicate_push_down optimizer path; done means both settings return the same result, consistent with MySQL.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.