New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
var_pop
on constant values may produce wrong result.
#52981
Comments
The plan looks all right, var_pop is executed in tidb side, the implementation of var_pop seems incorrect:
|
/label affects-5.4 |
/label affects-6.1 |
/label affects-6.5 |
/label affects-7.1 |
/label affects-7.5 |
/assign @SeaRise |
Simplified case
|
/label severity/minor |
@SeaRise: The label(s) In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
/severity minor |
The root cause is an issue with float64 addition precision. As mentioned in the previous comment, the sum of |
1. Minimal reproduce step (Required)
Firstly, execute
init.sql
to create the table. Then executingerror.sql
yields unexpected results. Note that reproducing these results might not be entirely stable. Typically, it can be completed within three attempts. You can try executingerror.sql
multiple times or executeinit.sql
again to rebuild the table.init.sql.txt
error.sql.txt
2. What did you expect to see? (Required)
The SQL statement calculates the var_pop value of the constant expression
604102521670485727
, and the result should be 0.3. What did you see instead (Required)
However, the statement results are unstable; in both the multi-node and single-node versions, there are some 0 and non-zero values.
output_re_main2.log
output_re_single2.log
4. What is your TiDB version? (Required)
topology:
distributed.yaml:
single.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.
The text was updated successfully, but these errors were encountered: