-
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
An incorrect query result #41878
Comments
tried in mysql: mysql> CREATE TABLE t1 (c0 decimal(10,0));
Query OK, 0 rows affected (0.01 sec)
mysql> INSERT INTO t1 VALUES (0);
Query OK, 1 row affected (0.00 sec)
mysql> SELECT c0 FROM t1 WHERE CAST(ATAN2(((t1.c0) IS NULL), (- (''))) AS TIME);
+------+
| c0 |
+------+
| 0 |
+------+
1 row in set (0.00 sec) |
The root cause is the ATAN2 function behaves differently in tidb and tikv, and tidb behaves the same as MySQL:
|
This issue occurs because TiDB ignores the sign bit when encoding the floating-point constant -0 and pushing it down to TiKV. TiKV use the 0 to calcute the result and get wrong. |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
The SELECT statement should return the value 0.
3. What did you see instead (Required)
The SELECT statement returns an empty set.
4. What is your TiDB version? (Required)
Release Version: v6.6.0
Edition: Community
Git Commit Hash: f4ca082
Git Branch: heads/refs/tags/v6.6.0
UTC Build Time: 2023-02-17 14:49:02
GoVersion: go1.19.5
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv
The text was updated successfully, but these errors were encountered: