pingcap / pingcap/tidb

Inconsistent results for WHERE LENGTH(const) > CHAR_LENGTH(DOUBLE_COL) between TiKV and TiFlash

Open
#61,436 1 comment 0 reactions 0 assignees View on GitHub
severity/moderate sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

### 1. Minimal reproduce step (Required)
```
DROP TABLE IF EXISTS t0 ;
CREATE TABLE t0(c0 DOUBLE);
ALTER TABLE t0 SET TIFLASH REPLICA 1;
INSERT INTO t0 VALUES (4.9E-324);

SELECT /*+ read_from_storage(tikv[t0]) */ true FROM t0 WHERE ((LENGTH(1199426508))>(CHAR_LENGTH(t0.c0)));
SELECT /*+ read_from_storage(tiflash[t0]) */ true FROM t0 WHERE ((LENGTH(1199426508))>(CHAR_LENGTH(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]) */ true FROM t0 WHERE ((LENGTH(1199426508))>(CHAR_LENGTH(t0.c0)));
Empty set (0.00 sec)

mysql> SELECT /*+ read_from_storage(tiflash[t0]) */ true FROM t0 WHERE ((LENGTH(1199426508))>(CHAR_LENGTH(t0.c0)));
+------+
| TRUE |
+------+
| 1 |
+------+
1 row in 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.