pingcap / pingcap/tidb

Different div precision between tidb and tiflash

Open
#55,294 1 comment 0 reactions 0 assignees View on GitHub
affects-8.5 impact/wrong-result may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 report/customer 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)

```
create table t(id int, num decimal);
insert into t values(1,100);
alter table t set tiflash replica 1;
select /*+ read_from_storage(tikv[t]) */ length(sum(num)/10) from t group by id;
select /*+ read_from_storage(tiflash[t]) */ length(sum(num)/10) from t group by id;
```

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

The div result in tidb has the same length with tiflash.

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

```
mysql> select /*+ read_from_storage(tikv[t]) */ length(sum(num)/10) from t group by id;
+---------------------+
| length(sum(num)/10) |
+---------------------+
| 12 |
+---------------------+
1 row in set (0.00 sec)

mysql> select /*+ read_from_storage(tiflash[t]) */ length(sum(num)/10) from t group by id;
+---------------------+
| length(sum(num)/10) |
+---------------------+
| 7 |
+---------------------+
1 row in set (0.04 sec)

mysql> select /*+ read_from_storage(tikv[t]) */ sum(num)/10 from t group by id union select /*+ read_from_storage(tiflash[t]) */ sum(num)/10 from t group by id;
+-------------+
| sum(num)/10 |
+-------------+
| 10.0000 |
| 10.0000 |
+-------------+
2 rows in set (0.02 sec)
```

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

v7.1.5, master

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.