pingcap / pingcap/tidb

Wrong result in Tiflash when processing timestamp

Open
#57,653 2 comments 0 reactions 0 assignees View on GitHub
affects-8.4 affects-8.5 impact/inconsistency may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 severity/major 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)

```sql
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
c0 TIMESTAMP,
c1 DOUBLE,
c2 TIMESTAMP AS (c0) VIRTUAL NOT NULL,
c3 INT UNSIGNED NOT NULL,
c4 VARCHAR(255),
c5 JSON,
PRIMARY KEY (c3),
UNIQUE INDEX idx1 (c2, c0),
INDEX idx2 (c4)
);

ALTER TABLE t1 SET TIFLASH REPLICA 1;
INSERT IGNORE INTO t1(c1, c3, c4, c5)
VALUES
(-10.0, 2900, 'example', '{"key": "value"}'),
(232.0, 3921, 'test', '{"key": "test"}'),
(12222.0, 2123, 'demo', '{"key": "demo"}');
```

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

I find that the returned information is inconsistent across two queries.

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

```sql
mysql> SELECT /*+ READ_FROM_STORAGE(tikv[t1]) */ c0
-> FROM t1
-> WHERE c1 = -10 and c2 IS NOT NULL or JSON_UNQUOTE(JSON_EXTRACT(c5, '$.key')) = 'value';
+---------------------+
| c0 |
+---------------------+
| 0000-00-00 00:00:00 |
+---------------------+
1 row in set (0.05 sec)

mysql> SELECT /*+ READ_FROM_STORAGE(tiflash[t1]) */ c0
-> FROM t1
-> WHERE c1 = -10 and c2 IS NOT NULL or JSON_UNQUOTE(JSON_EXTRACT(c5, '$.key')) = 'value';
+------+
| c0 |
+------+
| NULL |
+------+
1 row in set (0.05 sec)
```

### 4. What is your TiDB version? (Required)

TiDB v8.4.0

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.