pingcap / pingcap/tidb

Inconsistent results for SUM(DATE(col) IS TRUE) between TiKV and TiFlash

Open
#61,432 0 comments 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(c1 MEDIUMINT , c2 BIGINT );
INSERT INTO t0 VALUES (2730002, -9223372036854775808);
ALTER TABLE t0 SET TIFLASH REPLICA 1;

select /*+ read_from_storage(tikv[t0]) */ SUM(DATE(t0.c1) IS TRUE) from t0;
select /*+ read_from_storage(tiflash[t0]) */ SUM(DATE(t0.c1) IS TRUE) 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]) */ SUM(DATE(t0.c1) IS TRUE) from t0;
+--------------------------+
| SUM(DATE(t0.c1) IS TRUE) |
+--------------------------+
| 0 |
+--------------------------+
1 row in set, 1 warning (0.00 sec)

mysql> select /*+ read_from_storage(tiflash[t0]) */ SUM(DATE(t0.c1) IS TRUE) from t0;
+--------------------------+
| SUM(DATE(t0.c1) IS 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.