Bug #107168 window function: lead
Submitted: 30 Apr 2022 9:18 Modified: 30 May 2022 11:39
Reporter: Chen Junhui Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[30 Apr 2022 9:18] Chen Junhui
Description:
使用以下SQL语句,创建表并执行查询
在8.0.20版本返回了正确的分组结果
在8.0.26版本返回了错误的分组结果

How to repeat:
create table  bug_table as 
with t0 as 
(
select  'A' name , '2022-04-08 10:09:30' open_time
union all select 'A' name , '2022-04-11 13:36:56' open_time
union all select 'A' name , '2022-04-12 10:03:31' open_time
union all select 'A' name , '2022-04-12 10:05:00' open_time
union all select 'A' name , '2022-04-12 10:06:03' open_time
union all select 'B' name , '2022-04-12 10:48:15' open_time
union all select 'B' name , '2022-04-12 10:56:12' open_time
)
select * from t0;

WITH t0 AS (
select * from bug_table
),
t1 AS (
SELECT
	t0.NAME,
	t0.open_time,
	lead( t0.open_time, 1 ) over ( PARTITION BY t0.NAME ORDER BY t0.open_time ) lead_1_time
FROM
	t0 
) 
SELECT @@version,
ROW_NUMBER()over(partition by t1.name ) rn, 
t1.NAME,
t1.open_time,
t1.lead_1_time
FROM
t1;
[30 Apr 2022 11:39] MySQL Verification Team
Thank you for the bug report. Our bug system uses English language so bugs filed with another language isn't accepted also show clearly which is the result expected  using our latest released server 8.0.29. Thanks.
[1 Jun 2022 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".