Open r33s3n6 opened 1 month ago
Reproduction simplified:
create table t2(d decimal(11, 4));
alter table t2 set tiflash replica 1;
insert into t2 values(-0.741);
SELECT /*+ read_from_storage(tiflash[t2]) */ * from t2;
+---------+
| d |
+---------+
| -0.7410 |
+---------+
SELECT /*+ read_from_storage(tiflash[t2]) */ cast(d as decimal) from t2;
+--------------------+
| cast(d as decimal) |
+--------------------+
| 1 |
+--------------------+
However if we cast to a decimal type with fraction part, the result is correct:
SELECT /*+ read_from_storage(tiflash[t2]) */ cast(d as decimal(10, 1)) from t2;
+---------------------------+
| cast(d as decimal(10, 1)) |
+---------------------------+
| -0.7 |
+---------------------------+
Might be something wrong in tiflash decimal casting implementation.
Lower severity to major.
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
topology:
distributed.yaml:
about us
We are the BASS team from the School of Cyber Science and Technology at Beihang University. Our main focus is on system software security, operating systems, and program analysis research, as well as the development of automated program testing frameworks for detecting software defects. Using our self-developed database vulnerability testing tool, we have identified the above-mentioned vulnerabilities in TiDB that may lead to database logic error.