-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
query with distinct gets a unexpected result #51109
Comments
The root case is in TiKV cast(float as string) returns wrong result
But since float itself is not an accurate type, I think the severity can be changed to |
The same testcase returns empty in mysql v8.3.0. 6 |
/assign @solotzg |
if you convert float32(b) to float32, and then get float64 for comparison of original one later. you will get 4474.78125 So value float64 -> float32 is not always the same and safe as we thought unless you deliberately compare it with the original field type: float32. That means you need to do the comparison based on: 4474.781250000000000.GetFloat32 And 4474.781200000000354.GetFloat32, where you will get 4474.7812 and 4474.7812. Line 987 in 81da4f8
downcast is dangerous or not is up to what you do next, in ranger builder, you may ganna compare it with the original thing to decide range exclusion or not even based on float64. That's definitely a dangerous thing. |
The default behaviors of casting real type to string are different between tidb and tikv. |
/remove-severity major |
/severity minor |
Bug fix #53129 has been reverted because tidb-tools (such as lightning) rely on crc function of tidb. crc module needs to cast basic type into string at first, which means all behavior about casting into str cannot be modified in order to keep backward compatibility. |
For float type, when more than 6 significant digits, the precision cannot be guaranteed in ieee rules. This issue is able to be regarded as corner case. |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
Empty result
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
4e41699
The text was updated successfully, but these errors were encountered: