-
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
count() is incompatible with mysql and tidb #23549
Comments
Verified as described. My client returned a warning for this statement though: mysql> select col1 from t1 group by col1 having count(col1) = "1e64";
+------+
| col1 |
+------+
| tidb |
+------+
1 row in set, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+----------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------+
| Warning | 1690 | BIGINT value is out of range in '1e64' |
+---------+------+----------------------------------------+
1 row in set (0.00 sec) |
desc select col1 from t1 group by col1 having count(col1) = "1e64";
+------------------------------+---------+-----------+---------------+--------------------------------------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+------------------------------+---------+-----------+---------------+--------------------------------------------------------------------------------------------------------+
| Projection_6 | 0.80 | root | | test.t1.col1 |
| └─Selection_7 | 0.80 | root | | eq(Column#3, 1) |
| └─HashAgg_10 | 1.00 | root | | group by:test.t1.col1, funcs:count(test.t1.col1)->Column#3, funcs:firstrow(test.t1.col1)->test.t1.col1 |
| └─TableReader_15 | 1.00 | root | | data:TableFullScan_14 |
| └─TableFullScan_14 | 1.00 | cop[tikv] | table:t1 | keep order:false, stats:pseudo |
+------------------------------+---------+-----------+---------------+--------------------------------------------------------------------------------------------------------+
5 rows in set, 1 warning (0.00 sec) |
This issue is introduced by #23281. Obviously, it's not directly related to this issue. The root cause and how to fix it need further investigation. |
As XuHuaiyu said above, the result is wrong because the The direct reason for the Line 496 in 9339955
Changing it to |
Can't reproduce this, this issue might have been fixed by some other PR:
|
Fixed by #47803 |
Bug Report
Please answer these questions before submitting your issue. Thanks!
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)
The text was updated successfully, but these errors were encountered: