Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -586,3 +586,42 @@ sales 4 4800 14600

-- !sql --

-- !sql --
1 60
2 60
3 60
4 60
5 60
7 60
8 60
9 60
10 60
11 60

-- !sql --
1 1
2 3
3 6
4 10
5 15
7 22
8 30
9 39
10 49
11 60

-- !sql --
1 2
1 3
1 3
1 4
2 6
3 9
4 12
5 16
7 20
8 24
9 27
10 30
11 21

Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,22 @@ suite("test_window_fn") {
WHERE total <> fourcount + twosum;
"""

// cte
qt_sql """
with cte as (select empno as x from ${tbName1})
SELECT x, (sum(x) over (ORDER BY x range between UNBOUNDED preceding and UNBOUNDED following)) FROM cte;
"""
qt_sql """
with cte as (select empno as x from ${tbName1})
SELECT x, (sum(x) over (ORDER BY x range between UNBOUNDED preceding and CURRENT ROW)) FROM cte;
"""
qt_sql """
WITH cte AS (
select 1 as x union all select 1 as x union all select 1 as x union all
SELECT empno as x FROM ${tbName1})
SELECT x, (sum(x) over (ORDER BY x rows between 1 preceding and 1 following)) FROM cte;
"""

sql "DROP TABLE IF EXISTS ${tbName1};"
sql "DROP TABLE IF EXISTS ${tbName2};"
}
Expand Down