pingcap / pingcap/tidb

Data Inconsistency: TiFlash Returns Erroneous BIGINT Displayed as Signed TINYINT, Differing from TiKV After DDL (BOOL to BIGINT)

Open
#61,685 1 comment 0 reactions 0 assignees View on GitHub
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 BOOL DEFAULT false , c1 SMALLINT ZEROFILL , c2 FLOAT UNSIGNED NOT NULL , PRIMARY KEY(c0, c1, c2));
ALTER TABLE t0 SET TIFLASH REPLICA 1;
CREATE INDEX i0 ON t0(c0 ASC);
INSERT INTO t0(c0, c1, c2) VALUES (false, 28113, 0.4882897927434835);
INSERT IGNORE INTO t0(c0, c1, c2) VALUES (true, -23905, 0.06630539889272724);
ALTER TABLE t0 MODIFY c0 BIGINT;
DELETE FROM t0 WHERE (t0.c2) IS TRUE;
INSERT INTO t0(c0, c1, c2) VALUES (-1595799905, 4841, 0.9775436227802476);

select /*+ read_from_storage(tikv[t0]) */ t0.c0 from t0;
select /*+ read_from_storage(tiflash[t0]) */ t0.c0 from t0;
```

### 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;
+-------------+
| c0 |
+-------------+
| -1595799905 |
+-------------+
1 row in set (0.00 sec)

mysql> select /*+ read_from_storage(tiflash[t0]) */ t0.c0 from t0;
+-----+
| c0 |
+-----+
| -97 |
+-----+
1 row in set (0.01 sec)
```
### 4. What is your TiDB version? (Required)
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v9.0.0-beta.1.pre-918-g4419a28
Edition: Community
Git Commit Hash: 4419a28eb9cd988a7f2959c400aa21a63ee884fa
Git Branch: HEAD
UTC Build Time: 2025-06-11 05:47:23
GoVersion: go1.23.10
Race Enabled: false
Check Table Before Drop: false
Store: tikv
Kernel Type: Classic |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

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.