Bug #94612 Wrong results are returned with "group by"
Submitted: 10 Mar 2019 2:18 Modified: 10 Mar 2019 5:27
Reporter: Hope Lee Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S2 (Serious)
Version:8.0.15-rds-dev, 8.0.15, 5.7.25,5.6.43 OS:CentOS
Assigned to: CPU Architecture:Any

[10 Mar 2019 2:18] Hope Lee
Description:
The to_seconds() function returns the wrong answer with "group by".

How to repeat:
mysql> CREATE TABLE test_table2 (
       id bigint(20) NOT NULL,
       time_test time DEFAULT NULL,
       PRIMARY KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
mysql> insert into test_table2 values(1, '15:47:28');
mysql> select to_seconds(timediff(time_test,"19:30:00")) as col1 from test_table2;
+-------------+
| col1        |
+-------------+
| 63719209048 |
+-------------+
1 row in set (0.00 sec)
mysql> select to_seconds(timediff(time_test,"19:30:00")) as col1 from test_table2 group by col1;
+------------+
| col1       |
+------------+
| 2147483647 |
+------------+
1 row in set (0.00 sec)
[10 Mar 2019 5:27] Umesh Shastry
Hello Lee,

Thank you for the report and test case.

regards,
Umesh