2023-02-16 08:58:46 +00:00
|
|
|
-- { echo }
|
|
|
|
|
|
|
|
-- create table
|
|
|
|
drop table if exists test;
|
|
|
|
create table test(`a` Nullable(Int32), `b` Nullable(Int32)) ENGINE = Memory;
|
|
|
|
insert into test (a,b) values (1,null), (2,3), (4, 5), (6,null);
|
|
|
|
|
|
|
|
-- first value
|
|
|
|
select first_value(b) from test;
|
2023-02-21 02:41:58 +00:00
|
|
|
select first_value(b) ignore nulls from test;
|
|
|
|
select first_value(b) respect nulls from test;
|
2023-02-16 08:58:46 +00:00
|
|
|
|
|
|
|
-- last value
|
|
|
|
select last_value(b) from test;
|
2023-02-21 02:41:58 +00:00
|
|
|
select last_value(b) ignore nulls from test;
|
2023-02-21 08:06:05 +00:00
|
|
|
select last_value(b) respect nulls from test;
|
2023-11-21 16:24:04 +00:00
|
|
|
|
2024-07-12 12:49:26 +00:00
|
|
|
SET enable_analyzer = 1;
|
2023-11-21 16:24:04 +00:00
|
|
|
|
|
|
|
-- first value
|
|
|
|
select first_value(b) from test;
|
|
|
|
select first_value(b) ignore nulls from test;
|
|
|
|
select first_value(b) respect nulls from test;
|
|
|
|
|
|
|
|
-- last value
|
|
|
|
select last_value(b) from test;
|
|
|
|
select last_value(b) ignore nulls from test;
|
|
|
|
select last_value(b) respect nulls from test;
|