apache / doris

Apache Doris is an easy-to-use, high performance and unified analytics database.
https://doris.apache.org
Apache License 2.0
12.46k stars 3.24k forks source link

[BUG] Use of `lead` and `lag` at the same time may be garbled #6343

Open xinyiZzz opened 3 years ago

xinyiZzz commented 3 years ago

To Reproduce create table:

CREATE TABLE `test_table` (
  `a` varchar(32) NOT NULL COMMENT ""
) ENGINE=OLAP
DUPLICATE KEY(`a`)
COMMENT "OLAP"
DISTRIBUTED BY HASH(`a`) BUCKETS 2
PROPERTIES (
"replication_num" = "1",
"in_memory" = "false",
"storage_format" = "V2"
);

Load twice

INSERT INTO test_table (a) VALUES ("aaa"), ("aaa"), ("abc"), ("abc"), (11), (11), (22); 
INSERT INTO test_table (a) VALUES ("aaa"), ("aaa"), ("abc"), ("abc"), (11), (11), (22); 

query:

select  
    lead(a,1,null) over(partition by a) as t1,
    lag(a,1,null) over(partition by a) as t2
from test_table

result: infoflow 2021-07-29 21-39-55

francisoliverlee commented 3 years ago

same issue, i reproducer on 0.14.12 image

xinyiZzz commented 3 years ago

After testing, there is no problem with version 0.13.16, introduced in 0.14.12