-
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
Results of function SUM is different from MySQL. #11208
Comments
Confirming this still exists in master. Here is a minimal test case: DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id INT NOT NULL PRIMARY KEY auto_increment,
c1 char(20) COLLATE utf8mb4_general_ci DEFAULT NULL,
INDEX (c1)
);
INSERT INTO `t1` VALUES (1,'ualplpbmupsw'),(2,'nau'),(3,'w'),(4,'o'),(5,'b'),(6,'izbna'),(7,NULL),(8,'what'),(9,'or'),(10,'now'),(11,NULL),(12,'qfbizbnaualplpb'),(13,NULL),(14,NULL),(15,'d'),(16,NULL),(17,'q'),(18,'ciitqf'),(19,NULL),(20,'t'),(21,NULL),(22,'or'),(23,'mciitqfbizb'),(24,'had'),(25,NULL),(26,'eqkdmciitqf'),(27,'nfeqkdmc'),(28,NULL),(29,'poldnfeqkdmcii'),(30,'epoldnfeqk'),(31,'can'),(32,'o'),(33,NULL),(34,NULL),(35,'he'),(36,NULL),(37,'b'),(38,'obkyixepol'),(39,NULL),(40,NULL),(41,'bluro'),(42,NULL),(43,NULL),(44,'r'),(45,NULL),(46,NULL),(47,'rnsrj'),(48,'no'),(49,NULL),(50,'e'),(51,'all'),(52,'you\'re'),(53,'ugbyw'),(54,'to'),(55,'b'),(56,'will'),(57,NULL),(58,'get'),(59,'how'),(60,'go'),(61,'o'),(62,'a'),(63,'d'),(64,'we'),(65,NULL),(66,'uyzenmd'),(67,'m'),(68,'x'),(69,'ihzuyzenm'),(70,'pdihzuyzenm'),(71,NULL),(72,'kkgpdihzuyze'),(73,'him'),(74,'don\'t'),(75,'t'),(76,'r'),(77,NULL),(78,NULL),(79,NULL),(80,'at');
SELECT SUM(MD5(c1)) FROM t1;
..
mysql> SELECT SUM(MD5(c1)) FROM t1;
+--------------+
| SUM(MD5(c1)) |
+--------------+
| +Inf |
+--------------+
1 row in set, 57 warnings (0.00 sec)
mysql> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-750-g8a661044c
Edition: Community
Git Commit Hash: 8a661044cedf8daad1de4fbf79a390962b6f6c3b
Git Branch: master
UTC Build Time: 2020-07-10 10:52:37
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec)
|
I want to fix this issue, but it doesn't have |
/pick-up |
It is not a pickable issue! MoreTip : If you want this issue to be picked, you need to add a Warning: None |
@vagetablechicken @XiaoGe2030 You can pick it now. |
/pick-up |
Pick up success. |
We could make the test case more simplify.
TIDB:
MySQL:
|
@vagetablechicken You did not submit PR within 7 days, so give up automatically. |
For now on the master branch: tidb(localhost:4000) > create table t2(id INT, md5int DOUBLE);
Query OK, 0 rows affected (0.02 sec)
tidb(localhost:4000) > insert into `t2` values (1, 1.7976931348623157e308),(2, 1.7976931348623157e308);
Query OK, 2 rows affected (0.01 sec)
Records: 2 Duplicates: 0 Warnings: 0
tidb(localhost:4000) > select sum(md5int) from t2;
ERROR 1105 (HY000): runtime error: slice bounds out of range [:-1] And mysql 8.0.22: +-------------+
| sum(md5int) |
+-------------+
| 0 |
+-------------+
1 row in set (0.00 sec) |
/pick-up |
Pick up success. |
Please edit this comment or add a new comment to complete the following informationNot a bug
Duplicate bug
BugNote: Make Sure that 'component', and 'severity' labels are added 1. Root Cause Analysis (RCA) (optional)2. Symptom (optional)3. All Trigger Conditions (optional)4. Workaround (optional)5. Affected versions6. Fixed versions |
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
If possible, provide a recipe for reproducing the error.
tidb-server -V
or runselect tidb_version();
on TiDB)?8c20289
SIG slack channel
#sig-exec
Score
Mentor
The text was updated successfully, but these errors were encountered: