Skip to content
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

Closed
SunRunAway opened this issue Jul 11, 2019 · 13 comments · Fixed by #21058
Closed

Results of function SUM is different from MySQL. #11208

SunRunAway opened this issue Jul 11, 2019 · 13 comments · Fixed by #21058
Labels
challenge-program component/expression help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@SunRunAway
Copy link
Contributor

SunRunAway commented Jul 11, 2019

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
CREATE TABLE `table80_int_autoinc` (
  `col_float_signed_key` float DEFAULT NULL,
  `col_decimal_40_20_unsigned` decimal(40,20) unsigned DEFAULT NULL,
  `col_decimal_6_3_signed` decimal(6,3) DEFAULT NULL,
  `col_decimal_10_4_unsigned_key` decimal(10,4) unsigned DEFAULT NULL,
  `pk` int(11) NOT NULL AUTO_INCREMENT,
  `col_bigint_signed_key` bigint(20) DEFAULT NULL,
  `col_bigint_signed` bigint(20) DEFAULT NULL,
  `col_bigint_unsigned` bigint(20) unsigned DEFAULT NULL,
  `col_float_unsigned` float unsigned DEFAULT NULL,
  `col_decimal_6_3_unsigned` decimal(6,3) unsigned DEFAULT NULL,
  `col_decimal_40_20_signed_key` decimal(40,20) DEFAULT NULL,
  `col_double_signed` double DEFAULT NULL,
  `col_decimal_6_3_signed_key` decimal(6,3) DEFAULT NULL,
  `col_decimal_10_4_signed_key` decimal(10,4) DEFAULT NULL,
  `col_float_unsigned_key` float unsigned DEFAULT NULL,
  `col_decimal_40_20_signed` decimal(40,20) DEFAULT NULL,
  `col_char_20` char(20) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `col_double_unsigned_key` double unsigned DEFAULT NULL,
  `col_decimal_10_4_unsigned` decimal(10,4) unsigned DEFAULT NULL,
  `col_float_signed` float DEFAULT NULL,
  `col_decimal_6_3_unsigned_key` decimal(6,3) unsigned DEFAULT NULL,
  `col_char_20_key` char(20) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `col_bigint_unsigned_key` bigint(20) unsigned DEFAULT NULL,
  `col_decimal_40_20_unsigned_key` decimal(40,20) unsigned DEFAULT NULL,
  `col_double_signed_key` double DEFAULT NULL,
  `col_varchar_20_key` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `col_double_unsigned` double unsigned DEFAULT NULL,
  `col_decimal_10_4_signed` decimal(10,4) DEFAULT NULL,
  `col_varchar_20` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`pk`),
  KEY `col_float_signed_key` (`col_float_signed_key`),
  KEY `col_decimal_10_4_unsigned_key` (`col_decimal_10_4_unsigned_key`),
  KEY `col_bigint_signed_key` (`col_bigint_signed_key`),
  KEY `col_decimal_40_20_signed_key` (`col_decimal_40_20_signed_key`),
  KEY `col_decimal_6_3_signed_key` (`col_decimal_6_3_signed_key`),
  KEY `col_decimal_10_4_signed_key` (`col_decimal_10_4_signed_key`),
  KEY `col_float_unsigned_key` (`col_float_unsigned_key`),
  KEY `col_double_unsigned_key` (`col_double_unsigned_key`),
  KEY `col_decimal_6_3_unsigned_key` (`col_decimal_6_3_unsigned_key`),
  KEY `col_char_20_key` (`col_char_20_key`),
  KEY `col_bigint_unsigned_key` (`col_bigint_unsigned_key`),
  KEY `col_decimal_40_20_unsigned_key` (`col_decimal_40_20_unsigned_key`),
  KEY `col_double_signed_key` (`col_double_signed_key`),
  KEY `col_varchar_20_key` (`col_varchar_20_key`)
) ENGINE=InnoDB AUTO_INCREMENT=81 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
INSERT INTO `table80_int_autoinc` VALUES (NULL,12.98731000000000000000,1.000,12.9910,1,-1,13,13,0.112345,0.000,NULL,0.00000001,0.000,4933.0000,NULL,0.00000001000000000000,'alplpb',12.98731,12.9873,12.991,12.987,'ualplpbmupsw',NULL,0.00000000000000000000,-115,'aualplpbmup',0,1.0988,'out'),(-9,0.00000000000000000000,-111.121,NULL,2,13,13,NULL,0,0.000,1.09878100000000000000,-111.1212,-9.182,12.9873,9399,-9.18230000000000000000,'the',0,0.0000,12.9873,0.000,'nau',0,NULL,-0.987103,NULL,0,NULL,'i'),(0.00000001,12.98731000000000000000,999.999,0.0000,3,0,52,0,0,12.987,1.09878100000000000000,0.112345,-61.000,-9.1823,1.009,0.11234500000000000000,'would',0.112345,NULL,0.00000001,0.112,'w',13,0.00000000000000000000,-111.1212,'then',12.98731,-1.0000,'bnaualplpbm'),(0,0.00000000000000000000,0.000,0.0000,4,0,0,1,1,0.000,-91.00000000000000000000,0.999999999,-9.182,-9.1823,12.991,-0.00000000100000000000,NULL,88,0.0000,1.09878,12.991,'o',1,12.99100000000000000000,-0.987103,'were',0,-0.9871,'zbnaualplp'),(1.009,0.11234500000000000000,1.099,12.9873,5,0,31326,0,80,0.000,1.00900000000000000000,0.00000001,12.991,1.0988,12.9873,-0.00000000100000000000,NULL,NULL,0.0000,1,0.000,'b',13,12.98731000000000000000,12.98731,'t',1.098781,0.0000,NULL),(22,0.00000000000000000000,NULL,0.0000,6,-5432,-111,0,0,0.000,-10.00000000000000000000,-9.1823,0.000,-111.1212,0,0.00000000000000000000,NULL,12.991,NULL,1.09878,0.000,'izbna',0,0.00000000000000000000,-0.999999999,'he',1.098781,0.0000,NULL),(-0.987103,12.98731000000000000000,-111.121,1.0000,7,-111,1,NULL,1.009,1.099,0.00000001000000000000,-94,1.009,-28147.0000,0,1.00900000000000000000,'time',0.112345,1.0988,-0.000000001,0.000,NULL,0,0.00000000000000000000,0.00000001,'bizbn',0.112345,-111.1212,'see'),(1.09878,0.00000000000000000000,1.009,1.0000,8,1,0,1,0,0.000,-0.98710300000000000000,-0.999999999,-9.182,-111.1212,12.991,0.11234500000000000000,'t',0,0.1123,12.991,0.000,'what',1,NULL,1.009,'her',0.112345,-0.9871,'fbizbnaualp'),(1,0.00000000000000000000,-111.121,1.0090,9,1,NULL,0,12.991,0.112,-86.00000000000000000000,0.112345,0.112,12.9910,1,12.98731000000000000000,'a',0.112345,114.0000,-0.000000001,0.112,'or',0,NULL,-0.000000001,'v',1.009,-0.9871,'good'),(1.09878,0.00000000000000000000,1.099,NULL,10,-1,-9,0,0.00000001,1.009,-0.98710300000000000000,-9.1823,-999.999,NULL,4305,-0.00000000100000000000,'q',0.00000001,0.0000,0.112345,0.000,'now',13,0.11234500000000000000,-9.1823,'when',0,12.9910,'c'),(12.9873,0.00000001000000000000,0.000,NULL,11,0,-1,1,0,1.009,1.09878100000000000000,-111.1212,-0.987,-9.1823,0,12.99100000000000000000,'my',0,126.0000,-122,NULL,NULL,0,NULL,-111.1212,'n',0.00000001,NULL,NULL),(12.991,22406.00000000000000000000,-999.999,0.0000,12,-9,1,1,12.991,0.000,-0.99999999900000000000,1.098781,-9.182,NULL,0.112345,1.00900000000000000000,'p',0,12.9910,49,0.000,'qfbizbnaualplpb',13,12.98731000000000000000,-0.000000001,'tqfbizbnau',12.991,-111.1212,'were'),(12.991,0.00000000000000000000,49.000,NULL,13,13,15526,NULL,0.112345,26.000,-111.12120000000000000000,-111.1212,0.000,1.0090,1.09878,1.00900000000000000000,'k',1.098781,0.0000,1.009,1.099,NULL,0,1.09878100000000000000,-0.000000001,NULL,0.999999999,0.1123,'k'),(-1,12.99100000000000000000,-9.182,0.0000,14,-1,13,1,0,0.000,12.98731000000000000000,-111.1212,0.000,-119.0000,29076,-0.98710300000000000000,NULL,0,12.9873,0,NULL,NULL,0,0.99999999900000000000,-25398,NULL,0.112345,-1.0000,'i'),(-0.987103,1.09878100000000000000,-111.121,1.0988,15,-104,0,1,0,0.000,1.09878100000000000000,1.098781,-0.987,0.0000,0,0.99999999900000000000,'will',15054,1.0090,1,0.000,'d',13,1.09878100000000000000,0.999999999,'to',NULL,1.0988,'I'),(-9.1823,0.99999999900000000000,0.112,0.1123,16,-14519,1,0,0.112345,1.000,0.99999999900000000000,-0.987103,-0.987,-24690.0000,1.09878,0.00000000000000000000,'out',0,0.0000,-9.1823,1.099,NULL,0,0.00000001000000000000,-0.000000001,'iitqfbizbna',0,12.9873,NULL),(-1,0.00000000000000000000,23.000,12.9873,17,2969,-1,1,0,12.987,NULL,NULL,-1.000,12.9873,1.009,0.11234500000000000000,'j',0.999999999,12.9873,12.991,12.991,'q',0,1.00900000000000000000,1.098781,'tell',0,1.0090,'f'),(NULL,1.00900000000000000000,-18.000,NULL,18,0,0,0,0,0.000,12.99100000000000000000,-111.1212,-0.987,12.9910,0,-111.12120000000000000000,'o',0,0.0000,1.009,0.000,'ciitqf',0,0.00000001000000000000,-0.999999999,'k',0.999999999,-23676.0000,'x'),(NULL,1.00900000000000000000,-111.121,1.0000,19,13,-9,NULL,0,0.000,-101.00000000000000000000,-23516,0.000,1.0090,0,41.00000000000000000000,'about',0,0.0000,12.991,0.000,NULL,1,0.00000000000000000000,-23,'see',12.98731,12.9910,'z'),(12.9873,0.00000000000000000000,-111.121,NULL,20,-9,-48,1,0.112345,1.099,26508.00000000000000000000,12.98731,1.009,1.0988,0,12.98731000000000000000,'k',0.00000001,0.0000,-1,0.000,'t',0,0.00000000000000000000,0.00000001,NULL,0.112345,0.1123,'his'),(9,0.00000000000000000000,1.000,12.9910,21,13,0,0,12.991,0.000,-0.98710300000000000000,12.98731,0.000,0.0000,0.112345,0.00000000000000000000,NULL,0,12.9873,-111.121,1.000,NULL,0,12.99100000000000000000,0.112345,'b',0,0.0000,'s'),(-0.987103,0.11234500000000000000,30.000,0.0000,22,-111,-119,0,0.112345,0.000,0.00000000000000000000,0,1.000,-85.0000,0,-0.00000000100000000000,'are',0.112345,12.9873,0.112345,0.000,'or',1,12.99100000000000000000,-0.999999999,NULL,0,1.0000,'t'),(-1,0.00000000000000000000,12.991,0.0000,23,1,-1,0,0,1.099,12.99100000000000000000,1.098781,12.991,NULL,0,12.99100000000000000000,'look',10,1.0090,126,999.999,'mciitqfbizb',0,0.00000000000000000000,0.112345,NULL,0,0.0000,NULL),(-0.000000001,1.09878100000000000000,-0.987,0.0000,24,-1,0,0,1.09878,0.000,12.98731000000000000000,12.98731,12.991,1.0988,0,12.98731000000000000000,'r',0,0.0000,-111.121,NULL,'had',0,0.11234500000000000000,0.00000001,'o',0,0.0000,'dmciitqfbi'),(NULL,1.09878100000000000000,1.000,0.0000,25,0,NULL,0,1,0.000,NULL,12.98731,-23.000,NULL,105,-30132.00000000000000000000,'kdmciitqfbizbna',0,16886.0000,-0.000000001,0.000,NULL,13,0.00000000000000000000,-0.000000001,'qkd',0,NULL,'t'),(-9.1823,0.00000000000000000000,1.099,0.1123,26,13,0,0,12.991,12.987,0.00000000000000000000,-9.1823,0.112,1.0988,0,-0.00000000100000000000,'a',0,0.0000,-0.000000001,0.000,'eqkdmciitqf',NULL,0.11234500000000000000,8393,NULL,1.009,1.0090,'feqkdmc'),(1.009,0.00000000000000000000,1.099,0.0000,27,0,0,0,0,0.000,0.99999999900000000000,12.98731,-68.000,0.1123,12.9873,-0.98710300000000000000,'know',12.98731,59.0000,-111.121,0.112,'nfeqkdmc',13,0.11234500000000000000,-0.000000001,'of',0.00000001,12.9873,'dnfeqkdmci'),(35,0.00000000000000000000,110.000,1.0000,28,-111,-1,0,0.00000001,0.000,0.11234500000000000000,-15804,0.000,0.0000,0.00000001,NULL,NULL,0,0.0000,-0.000000001,1.009,NULL,13,0.00000000000000000000,15,'ld',0,29968.0000,'oldnfeqkdm'),(1.09878,0.00000001000000000000,-9.182,1.0988,29,-9,NULL,1,0,0.000,0.99999999900000000000,0.999999999,0.000,-6797.0000,0,0.11234500000000000000,'he\'s',0,0.0000,0.00000001,0.000,'poldnfeqkdmcii',0,0.00000001000000000000,-9.1823,NULL,0.00000001,1.0988,'b'),(12.9873,0.00000000000000000000,999.999,0.0000,30,-1,-9,0,0,0.000,1.09878100000000000000,12.98731,1.099,0.0000,NULL,-12074.00000000000000000000,'n',0.112345,0.0000,0.00000001,1.000,'epoldnfeqk',1,1.00900000000000000000,0.999999999,'but',1.009,-1.0000,NULL),(12.991,0.00000000000000000000,1.099,0.0000,31,0,1,9600,0,0.000,-0.00000000100000000000,6,-1.000,-0.9871,12.9873,0.00000001000000000000,'o',12.98731,1.0000,-3,1.000,'can',0,0.00000000000000000000,0.00000001,'yes',0,0.0000,'x'),(-17805,1.09878100000000000000,1.000,0.0000,32,0,1,1,0,0.000,-111.12120000000000000000,12.991,12.987,12.9873,1.009,-0.98710300000000000000,'b',0,NULL,12.991,0.000,'o',1,0.00000000000000000000,0.999999999,NULL,93,NULL,'ixepoldnfeqkd'),(0.112345,0.00000000000000000000,1.099,1.0090,33,-111,1,13,7921,NULL,0.11234500000000000000,1.009,-999.999,12.9910,0.00000001,0.00000000000000000000,'been',0.00000001,0.0000,NULL,0.000,NULL,0,0.00000000000000000000,2062,'know',1.009,1.0988,'yi'),(12.9873,12.98731000000000000000,-122.000,0.0000,34,NULL,1,1,17565,1.000,0.00000000000000000000,0.00000001,-111.121,0.0000,1.009,12.98731000000000000000,'this',23390,1.0090,NULL,12.991,NULL,13,12.98731000000000000000,0.00000001,'c',1.009,-39.0000,'kyixepo'),(12.9873,12.99100000000000000000,-0.987,0.0000,35,13,NULL,NULL,0,1.000,12.99100000000000000000,12.98731,12.987,0.0000,0.112345,12.99100000000000000000,'n',0,12.9873,12.991,1.000,'he',0,0.00000000000000000000,0,NULL,0,-0.9871,'d'),(0.00000001,1.09878100000000000000,999.999,1.0988,36,0,13,0,20901,12.991,-79.00000000000000000000,12.98731,-111.121,-20337.0000,1.09878,-0.98710300000000000000,'like',0,1.0000,0,1.099,NULL,0,0.00000000000000000000,-111.1212,'b',0.112345,-9.1823,NULL),(-111.121,1.09878100000000000000,12.987,12.9910,37,0,NULL,0,0,0.000,-3960.00000000000000000000,0.112345,12.991,12.9873,12.9873,1.00900000000000000000,'come',0,1.0000,-1,0.000,'b',NULL,0.00000000000000000000,-0.000000001,'okay',1.098781,12.9873,NULL),(-0.987103,1.09878100000000000000,-0.987,1.0000,38,-122,0,0,1.09878,0.000,1.00900000000000000000,-9.1823,1.009,-9.1823,1,0.00000001000000000000,'on',NULL,0.0000,-111.121,0.000,'obkyixepol',0,NULL,NULL,'v',0,0.0000,'g'),(-111.121,1.00900000000000000000,-111.121,0.0000,39,1,13,0,11708,1.000,-0.99999999900000000000,0.112345,-9.182,NULL,NULL,12.98731000000000000000,'o',0.999999999,0.0000,NULL,1.009,NULL,0,0.00000000000000000000,-0.000000001,'i',0.999999999,NULL,'rogobkyi'),(8062,0.00000000000000000000,-65.000,0.0000,40,13,0,0,0,0.000,-9.18230000000000000000,12.991,107.000,0.0000,0,0.11234500000000000000,NULL,1.098781,0.0000,0.112345,0.000,NULL,0,12.98731000000000000000,-0.000000001,'because',0,0.0000,'urogobkyixe'),(1,82.00000000000000000000,0.112,0.0000,41,NULL,0,84,12.991,0.000,-0.00000000100000000000,-111.1212,-0.987,0.0000,0,-9.18230000000000000000,'lurogo',NULL,0.0000,12.9873,1.009,'bluro',1,0.00000000000000000000,-111.1212,'here',0,0.1123,'go'),(-111.121,1.09878100000000000000,1.009,0.0000,42,1,-1,13,12.991,12.987,-40.00000000000000000000,NULL,0.112,-0.9871,12.9873,12.98731000000000000000,'of',98,0.0000,87,0.000,NULL,13,0.00000000000000000000,1021,'xblurogo',0,0.0000,'see'),(12.9873,0.00000000000000000000,0.000,NULL,43,1,1,0,12.991,NULL,1.00900000000000000000,12.991,0.000,45.0000,0,0.11234500000000000000,NULL,12.98731,0.0000,1.009,0.000,NULL,0,0.11234500000000000000,-0.000000001,'jxblurog',0,-111.1212,'I\'m'),(-124,0.00000000000000000000,-111.121,0.0000,44,0,0,0,0,0.000,12.99100000000000000000,12.98731,0.112,-30.0000,NULL,1.09878100000000000000,'h',0,0.0000,1.009,0.000,'r',22,0.00000000000000000000,NULL,'a',1.098781,-111.1212,'of'),(-1,0.00000000000000000000,-111.121,NULL,45,1,-1,0,NULL,0.000,-0.99999999900000000000,-9.1823,0.000,-111.1212,1.009,1.00900000000000000000,'d',0.999999999,0.0000,1.009,0.000,NULL,13,0.11234500000000000000,-9.1823,NULL,0,12.9873,'rjxblu'),(1.009,0.00000000000000000000,-9.182,1.0000,46,13,NULL,13,0,12.987,0.00000000000000000000,12.98731,-111.121,-7.0000,0,1.00900000000000000000,'z',0.112345,12.9873,-1,0.000,NULL,0,0.00000000000000000000,12.991,'p',NULL,1.0988,'srjxblurogobk'),(0.00000001,0.99999999900000000000,-999.999,12.9910,47,-31,-1,0,0,0.000,0.99999999900000000000,0,-1.000,49.0000,12.991,NULL,'nsrjxblurogob',0.112345,0.0000,0.00000001,0.000,'rnsrj',0,0.00000000000000000000,0.112345,'v',0,-0.9871,'c'),(0.112345,12.99100000000000000000,12.991,0.0000,48,13,0,NULL,1,0.000,0.99999999900000000000,-0.987103,-122.000,12.9873,0,12.98731000000000000000,'was',0.999999999,0.0000,0.112345,0.000,'no',NULL,0.99999999900000000000,1.098781,'krnsrjx',1.009,-112.0000,NULL),(0,12.98731000000000000000,-0.987,0.1123,49,-17,1,1,0,0.000,1.00900000000000000000,-0.000000001,-111.121,0.1123,NULL,-0.00000000100000000000,NULL,0,0.0000,-0.987103,0.000,NULL,0,0.00000000000000000000,12.98731,'dkrnsrjxbluro',0,1.0988,NULL),(-0.000000001,0.00000000000000000000,0.000,0.0000,50,0,-962,0,12.9873,0.000,12.98731000000000000000,0.112345,-111.121,0.0000,0,NULL,'adkrns',0.112345,11.0000,-0.987103,1.000,'e',1,0.00000000000000000000,-111.1212,'s',1.098781,-38.0000,'got'),(12.991,0.00000000000000000000,0.000,0.0000,51,-9,1,0,1,NULL,0.00000001000000000000,-3048,0.000,1.0000,1,NULL,'wadkrnsrjxbl',0,0.0000,12.9873,12.991,'all',NULL,0.00000000000000000000,-0.987103,'ywa',0,1.0000,'hey'),(-27944,0.00000000000000000000,12.987,0.1123,52,0,-5987,0,1,0.000,82.00000000000000000000,12.991,12.987,-115.0000,0,12.98731000000000000000,NULL,12.991,0.0000,-79,NULL,'you\'re',0,0.00000000000000000000,1.098781,'all',0,1.0988,'by'),(0.00000001,0.00000000000000000000,1.009,0.0000,53,1,-9,13,31210,30.000,12.99100000000000000000,NULL,-111.121,0.0000,12.9873,-14545.00000000000000000000,'gbyw',0,12.9910,12.9873,33.000,'ugbyw',1,NULL,NULL,'e',0,0.1123,'zugbywadkrnsrj'),(1.09878,1.09878100000000000000,-9.182,0.1123,54,13,-121,0,0,0.000,12.99100000000000000000,1.009,999.999,0.0000,0,0.00000001000000000000,'wzugbywadkrnsr',0.999999999,0.0000,0.00000001,0.000,'to',13,0.00000000000000000000,-9.1823,NULL,13237,0.0000,'with'),(12.9873,12.98731000000000000000,-1.000,0.0000,55,0,NULL,0,12.9873,NULL,-0.99999999900000000000,0.999999999,-111.121,NULL,0,-0.00000000100000000000,'xwzugbywadk',NULL,0.1123,1.009,1.000,'b',1,0.11234500000000000000,1.098781,NULL,12.991,1.0090,'obxwzugbyw'),(-111.121,0.00000000000000000000,0.000,0.0000,56,1,-1,1,0,0.000,0.00000000000000000000,0,0.000,NULL,0,-0.98710300000000000000,NULL,0.999999999,0.0000,0.00000001,12.991,'will',669,12.99100000000000000000,-9.1823,'bobx',0,4948.0000,'rbobxwzugbyw'),(12.9873,1.00900000000000000000,0.112,0.1123,57,0,-111,0,0,NULL,-9.18230000000000000000,0.00000001,-1.000,-1.0000,0,0.00000000000000000000,'vrbobxwzugbywad',29288,0.0000,0.00000001,0.000,NULL,1,0.99999999900000000000,29723,'tvrbobxwzugby',0.999999999,-111.1212,'could'),(-9.1823,0.00000000000000000000,-0.987,0.0000,58,NULL,-9,1,1.09878,0.112,-111.12120000000000000000,-0.987103,12.991,NULL,12.9873,1.00900000000000000000,'v',0,0.0000,-0.000000001,12.991,'get',1,12.99100000000000000000,-13194,'jtvr',0.112345,0.0000,'l'),(-1,12.99100000000000000000,0.000,12.9910,59,0,0,31521,12.9873,0.000,1.00900000000000000000,0.00000001,999.999,NULL,0,-27.00000000000000000000,'b',0.999999999,0.0000,-69,12.987,'how',13,0.00000000000000000000,1.009,NULL,12.98731,1.0090,'tell'),(3143,12.99100000000000000000,0.000,1.0988,60,-9,13,1,1.009,0.000,1.09878100000000000000,0.112345,-0.987,-0.9871,0,1.00900000000000000000,'cjtvrbobxw',0.112345,0.0000,0.00000001,0.000,'go',0,0.00000000000000000000,-0.000000001,'j',0,0.0000,NULL),(-21020,0.99999999900000000000,1.009,0.0000,61,1,0,1,49,0.000,0.00000001000000000000,-9.1823,-111.121,12.9910,1.09878,-23472.00000000000000000000,'a',0,0.0000,-0.000000001,0.000,'o',0,NULL,-102,NULL,1.098781,1.0090,NULL),(NULL,0.00000000000000000000,12.987,0.1123,62,0,-1,102,0,32.000,0.00000000000000000000,1.009,-9.182,-1.0000,NULL,12.98731000000000000000,NULL,0,1.0988,0.112345,0.000,'a',0,NULL,12.991,'n',0,12.9910,'dncjtvrbobxwzu'),(12096,12.98731000000000000000,0.000,0.0000,63,-11924,-9486,0,0,999.999,0.00000001000000000000,0.00000001,NULL,1.0090,1.009,1.09878100000000000000,'q',0,0.0000,12.9873,1.009,'d',13,12.99100000000000000000,-111.1212,'mdncjtvrbobxwz',0.112345,1.0090,NULL),(0.112345,0.00000000000000000000,0.000,0.0000,64,0,-1,NULL,0,1.009,-111.12120000000000000000,-58,999.999,-0.9871,1.09878,12.98731000000000000000,'nmdncjtvrbobxw',0,0.0000,0,1.009,'we',NULL,0.00000000000000000000,0,'see',0.00000001,-0.9871,'enmdncjtvrbo'),(0,0.00000000000000000000,999.999,0.0000,65,13,0,0,0.112345,1.009,-0.00000000100000000000,-111.1212,1.009,NULL,0,0.00000001000000000000,'x',NULL,0.0000,1.09878,1.000,NULL,0,12.98731000000000000000,0.112345,'s',0.999999999,1.0000,'zenmdncjt'),(0,0.99999999900000000000,12.991,0.1123,66,7124,0,0,1.09878,0.000,8500.00000000000000000000,-111.1212,-0.987,-0.9871,63,1.09878100000000000000,'y',0,1.0988,1.09878,12.987,'uyzenmd',0,12.98731000000000000000,-0.987103,'zuyzenmdnc',NULL,-0.9871,'here'),(-1,0.00000000000000000000,12.987,0.0000,67,-17814,1,19,0.112345,77.000,12.99100000000000000000,0.00000001,-1.000,0.1123,1,-0.99999999900000000000,NULL,0,0.0000,30,0.000,'m',13,0.00000000000000000000,0.00000001,'can',0,1.0090,NULL),(1,0.00000000000000000000,0.000,0.0000,68,4353,1,0,NULL,1.009,12.98731000000000000000,-21119,0.112,-1.0000,0,0.00000001000000000000,'right',0,1.0090,12.9873,0.000,'x',NULL,0.00000000000000000000,0.00000001,NULL,NULL,12.9910,NULL),(-0.000000001,0.00000001000000000000,0.000,0.0000,69,1,1,1,0,12.991,1.09878100000000000000,-0.000000001,-0.987,1.0090,0.112345,12.98731000000000000000,'hzu',NULL,1.0090,-111.121,12.987,'ihzuyzenm',0,1.00900000000000000000,23212,'dihzuyzenmdn',18723,0.0000,NULL),(-9.1823,12.98731000000000000000,0.112,NULL,70,0,-9,NULL,1.09878,12.987,63.00000000000000000000,-0.987103,0.000,1.0090,0,0.11234500000000000000,'b',0,0.0000,-0.000000001,12.987,'pdihzuyzenm',0,8984.00000000000000000000,15,NULL,0,0.0000,'would'),(NULL,12.98731000000000000000,12.987,19822.0000,71,0,NULL,0,0,0.000,1.09878100000000000000,1.098781,0.000,-1.0000,0,12.99100000000000000000,'gpdihzuyzenmdn',0,1.0000,NULL,1.000,NULL,0,0.00000000000000000000,-2172,NULL,0,-109.0000,NULL),(-0.987103,0.00000000000000000000,12.991,12.9873,72,0,-9,0,1.009,0.000,-0.99999999900000000000,-0.987103,1.099,12.9873,0,1.00900000000000000000,'kgpdih',0,0.0000,-23059,0.000,'kkgpdihzuyze',127,0.00000000000000000000,0.112345,NULL,12.98731,-20344.0000,NULL),(-0.987103,0.00000000000000000000,1.000,1.0988,73,13771,-7,0,0,0.000,-0.98710300000000000000,-0.000000001,0.000,0.0000,0,-9.18230000000000000000,NULL,1.009,NULL,12.9873,0.000,'him',0,0.99999999900000000000,-111.1212,NULL,0.00000001,0.0000,'mkkgpdihzuyzenm'),(-31751,1.00900000000000000000,0.000,1.0988,74,13,-29464,1,0.112345,12.991,0.11234500000000000000,12.991,-9.182,-111.1212,1.09878,1.00900000000000000000,'s',0,0.0000,1.09878,NULL,'don\'t',0,0.00000000000000000000,0.112345,'omkkgp',1.098781,-111.1212,'as'),(0,0.00000001000000000000,NULL,88.0000,75,0,-9,1,0,0.000,-0.99999999900000000000,-111.1212,NULL,-1.0000,1.009,0.00000001000000000000,'i',0.00000001,0.0000,1.009,1.000,'t',1,15.00000000000000000000,-111.1212,'lomkk',0.112345,-94.0000,'e'),(NULL,1.09878100000000000000,1.000,0.0000,76,1,-94,1,0,0.000,-9.18230000000000000000,NULL,0.000,0.0000,0,-9.18230000000000000000,'p',0.00000001,0.0000,-111.121,34.000,'r',0,1.00900000000000000000,0.112345,'t',1.009,12.9873,'tlo'),(1,0.99999999900000000000,0.000,12.9910,77,-98,0,0,0.00000001,0.000,13704.00000000000000000000,-112,1.099,12.9873,0,0.00000000000000000000,'b',0,0.0000,1,0.000,NULL,0,0.00000000000000000000,-111.1212,'ptlomkkgpd',0,-111.1212,'optlomkkgp'),(-0.987103,0.00000000000000000000,999.999,0.0000,78,13,-9,0,32,0.000,0.00000001000000000000,0,-0.987,0.0000,0,0.00000001000000000000,'c',0,1.0000,1,0.000,NULL,13,0.00000000000000000000,0.112345,'z',0,-122.0000,'ooptlomk'),(1.009,0.00000000000000000000,NULL,0.0000,79,0,-23535,1,12.9873,1.099,NULL,-0.987103,-111.121,0.1123,12.991,0.11234500000000000000,NULL,0,12.9873,0.00000001,12.991,NULL,0,0.11234500000000000000,0.112345,'sooptlomkkgpdi',NULL,NULL,'f'),(12.9873,0.99999999900000000000,12.987,0.0000,80,1,3585,0,0,NULL,0.00000001000000000000,0.999999999,NULL,12.9873,1.09878,NULL,NULL,0,0.0000,-0.987103,0.000,'at',0,0.00000000000000000000,12.991,'bsooptlomkk',0,NULL,'v');

  1. What did you expect to see?
mysql> SELECT SUM( MD5( `col_char_20_key` ) ) AS field7 FROM `table80_int_autoinc` ;
+--------+
| field7 |
+--------+
|      0 |
+--------+
1 row in set (0.00 sec)
  1. What did you see instead?
mysql> SELECT SUM( MD5( `col_char_20_key` ) ) AS field7 FROM `table80_int_autoinc` ;
+--------+
| field7 |
+--------+
|   +Inf |
+--------+
1 row in set, 57 warnings (0.00 sec)

mysql> show warnings;
+---------+------+----------------------------------------------------------------------+
| Level   | Code | Message                                                              |
+---------+------+----------------------------------------------------------------------+
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1292 | Truncated incorrect DOUBLE value: '8277e0910d750195b448797616e091ad' |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1292 | Truncated incorrect DOUBLE value: '8277e0910d750195b448797616e091ad' |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
| Warning | 1265 | Data Truncated                                                       |
+---------+------+----------------------------------------------------------------------+
57 rows in set (0.00 sec)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?

8c20289

SIG slack channel

#sig-exec

Score

  • 300

Mentor

@SunRunAway SunRunAway added type/bug The issue is confirmed as a bug. component/expression and removed component/expression labels Jul 11, 2019
@SunRunAway SunRunAway added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Jul 12, 2019
@ghost
Copy link

ghost commented Jul 13, 2020

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)

@vagetablechicken
Copy link

I want to fix this issue, but it doesn't have challenge-program label.

@XiaoGe2030
Copy link

/pick-up

@ti-challenge-bot
Copy link

It is not a pickable issue!

More

Tip : If you want this issue to be picked, you need to add a challenge-program label to it.

Warning: None

@SunRunAway
Copy link
Contributor Author

@vagetablechicken @XiaoGe2030 You can pick it now.

@vagetablechicken
Copy link

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@vagetablechicken
Copy link

We could make the test case more simplify.
The Minimum Test Case is

mysql> create table t2(id INT, md5int DOUBLE);
Query OK, 0 rows affected (0.07 sec)

mysql> insert into `t2` values (1, 1.7976931348623157e308),(2, 1.7976931348623157e308);
Query OK, 2 rows affected (0.01 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select * from t2;
+------+------------------------+
| id   | md5int                 |
+------+------------------------+
|    1 | 1.7976931348623157e308 |
|    2 | 1.7976931348623157e308 |
+------+------------------------+
2 rows in set (0.00 sec)

TIDB:

mysql> select sum(md5int) from t2;
+-------------+
| sum(md5int) |
+-------------+
|        +Inf |
+-------------+
1 row in set (0.00 sec)

MySQL:

mysql> select sum(md5int) from t2;
+-------------+
| sum(md5int) |
+-------------+
|           0 |
+-------------+
1 row in set (0.00 sec)

@ti-challenge-bot
Copy link

@vagetablechicken You did not submit PR within 7 days, so give up automatically.

@lzmhhh123
Copy link
Contributor

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)

@Win-Man
Copy link
Contributor

Win-Man commented Nov 11, 2020

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenge-program component/expression help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants