pingcap / pingcap/tidb

TiFlash and TiKV return different results for comparison between bitwise OR constant and ENUM column

Open
#61,438 2 comments 0 reactions 1 assignee Claimed by @hawkingrei View on GitHub
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)
```
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(c0 ENUM('b8hwfe2l', 's6zj', 'zx3js', 'vbuci', 'l2l6lx90') );
ALTER TABLE t0 SET TIFLASH REPLICA 1;
INSERT IGNORE INTO t0(c0) VALUES ('yp14128q');
UPDATE t0 SET c0=true;
CREATE INDEX i0 ON t0(c0) KEY_BLOCK_SIZE 5340524867573591996;

SELECT /*+ read_from_storage(tiflash[t0]) */ t0.c0 FROM t0 WHERE ((((1982833210)|(-544334148)))<(t0.c0));
SELECT /*+ read_from_storage(tikv[t0]) */ t0.c0 FROM t0 WHERE ((((1982833210)|(-544334148)))<(t0.c0));
```

### 2. What did you expect to see? (Required)
The same query returns the same results on both TiKV and TiFlash.
### 3. What did you see instead (Required)
```
mysql> SELECT /*+ read_from_storage(tikv[t0]) */ t0.c0 FROM t0 WHERE ((((1982833210)|(-544334148)))<(t0.c0));
+----------+
| c0 |
+----------+
| b8hwfe2l |
+----------+
1 row in set (0.00 sec)

mysql> SELECT /*+ read_from_storage(tiflash[t0]) */ t0.c0 FROM t0 WHERE ((((1982833210)|(-544334148)))<(t0.c0));
Empty set (0.01 sec)
```
### 4. What is your TiDB version? (Required)

+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v8.5.0
Edition: Community
Git Commit Hash: d13e52ed6e22cc5789bed7c64c861578cd2ed55b
Git Branch: HEAD
UTC Build Time: 2024-12-18 02:26:06
GoVersion: go1.23.3
Race Enabled: false
Check Table Before Drop: false
Store: tikv |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.