pingcap / pingcap/tidb

Same query results are inconsistent on TiKV and TiFlash when using cast(BLOB AS DECIMAL).

Open
#57,728 2 comments 0 reactions 0 assignees View on GitHub
severity/minor sig/execution 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)
prepare data
```sql
DROP table if exists t0;
CREATE TABLE t0(c0 BLOB(409) NOT NULL , c1 BOOL UNSIGNED UNIQUE , c2 BLOB(46) );
INSERT IGNORE INTO t0(c0, c2) VALUES (NULL, '\r2');
ALTER TABLE t0 SET TIFLASH REPLICA 1;
```
execute query
```sql
SELECT /*+ read_from_storage(tikv[t0]) */ * FROM t0 WHERE CAST(t0.c2 AS DECIMAL);
SELECT /*+ read_from_storage(tiflash[t0]) */ * FROM t0 WHERE CAST(t0.c2 AS DECIMAL);
```

### 2. What did you expect to see? (Required)
The results of the two queries are equal.

### 3. What did you see instead (Required)
Query1 result:
![Image](https://github.com/user-attachments/assets/1baf7e06-1fcb-481b-b5c2-4596e7792441)
Query2 result:
empty
### 4. What is your TiDB version? (Required)

Release Version: v8.4.0
Edition: Community
Git Commit Hash: 1a9f0fa25580907d3266dc3edf000ba24379a600
Git Branch: HEAD
UTC Build Time: 2024-11-07 15:18:43
GoVersion: go1.23.2
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.