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:
