@@ -40,6 +40,15 @@ select
40
40
, lead(v2, 2) over (partition by p1, p2 order by v1, v2) as out9
41
41
from t;
42
42
43
+ # range frame
44
+ statement ok
45
+ create view v_d as
46
+ select
47
+ *
48
+ , last_value(time) over (partition by p1 order by time desc range between current row and 2 following) as out10
49
+ , sum(v1) over (partition by p1 order by time range between 1 preceding and 1 following) as out11
50
+ from t;
51
+
43
52
statement ok
44
53
create view v_a_b as
45
54
select
@@ -59,6 +68,15 @@ select
59
68
, lead(v2, 2) over (partition by p1, p2 order by v1, v2) as out9
60
69
from t;
61
70
71
+ statement ok
72
+ create view v_a_d as
73
+ select
74
+ *
75
+ , first_value(v1) over (partition by p1, p2 order by time, id rows 3 preceding) as out1
76
+ , last_value(time) over (partition by p1 order by time desc range between current row and 2 following) as out10
77
+ , sum(v1) over (partition by p1 order by time range between 1 preceding and 1 following) as out11
78
+ from t;
79
+
62
80
statement ok
63
81
create view v_b_c as
64
82
select
@@ -70,6 +88,27 @@ select
70
88
, lead(v2, 2) over (partition by p1, p2 order by v1, v2) as out9
71
89
from t;
72
90
91
+ statement ok
92
+ create view v_b_d as
93
+ select
94
+ *
95
+ , sum(v1) over (partition by p1, p2 order by time, id rows between unbounded preceding and current row) as out3
96
+ , min(v1) over (partition by p1, p2 order by time, id rows between current row and unbounded following) as out4
97
+ , last_value(time) over (partition by p1 order by time desc range between current row and 2 following) as out10
98
+ , sum(v1) over (partition by p1 order by time range between 1 preceding and 1 following) as out11
99
+ from t;
100
+
101
+ statement ok
102
+ create view v_c_d as
103
+ select
104
+ *
105
+ , lag(v1) over (partition by p1, p2 order by time, id) as out7
106
+ , lead(v2, 1) over (partition by p1, p2 order by time, id) as out8
107
+ , lead(v2, 2) over (partition by p1, p2 order by v1, v2) as out9
108
+ , last_value(time) over (partition by p1 order by time desc range between current row and 2 following) as out10
109
+ , sum(v1) over (partition by p1 order by time range between 1 preceding and 1 following) as out11
110
+ from t;
111
+
73
112
statement ok
74
113
create view v_a_b_c as
75
114
select
@@ -84,3 +123,20 @@ select
84
123
, lead(v2, 1) over (partition by p1, p2 order by time, id) as out8
85
124
, lead(v2, 2) over (partition by p1, p2 order by v1, v2) as out9
86
125
from t;
126
+
127
+ statement ok
128
+ create view v_a_b_c_d as
129
+ select
130
+ *
131
+ , first_value(v1) over (partition by p1, p2 order by time, id rows 3 preceding) as out1
132
+ , avg(v1) over (partition by p1) as out2
133
+ , sum(v1) over (partition by p1, p2 order by time, id rows between unbounded preceding and current row) as out3
134
+ , min(v1) over (partition by p1, p2 order by time, id rows between current row and unbounded following) as out4
135
+ , lag(v1, 0) over (partition by p1 order by id) as out5
136
+ , lag(v1, 1) over (partition by p1, p2 order by id) as out6
137
+ , lag(v1) over (partition by p1, p2 order by time, id) as out7
138
+ , lead(v2, 1) over (partition by p1, p2 order by time, id) as out8
139
+ , lead(v2, 2) over (partition by p1, p2 order by v1, v2) as out9
140
+ , last_value(time) over (partition by p1 order by time desc range between current row and 2 following) as out10
141
+ , sum(v1) over (partition by p1 order by time range between 1 preceding and 1 following) as out11
142
+ from t;
0 commit comments