Skip to content

Commit

Permalink
Minor: Add sql level test for lead/lag on arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed May 2, 2024
1 parent 97148bd commit c1b706e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions datafusion/sqllogictest/test_files/window.slt
Original file line number Diff line number Diff line change
Expand Up @@ -4799,3 +4799,33 @@ NULL 4
NULL 3
NULL 2
NULL 1


### Test for window functions with arrays
statement ok
create table array_data
as values
('a',make_array(1, 2, 3)),
('b', make_array(4, 5, 6)),
('c', make_array(7, 8, 9));

query T?
SELECT column1, column2 FROM array_data ORDER BY column1;
----
a [1, 2, 3]
b [4, 5, 6]
c [7, 8, 9]

query T??
SELECT
column1,
lag(column2) OVER (order by column1),
lead(column2) OVER (order by column1)
FROM array_data;
----
a NULL [4, 5, 6]
b [1, 2, 3] [7, 8, 9]
c [4, 5, 6] NULL

statement ok
drop table array_data

0 comments on commit c1b706e

Please sign in to comment.