-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into xxchan/exuberant-cod
- Loading branch information
Showing
15 changed files
with
257 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
statement ok | ||
SET RW_IMPLICIT_FLUSH TO true; | ||
|
||
statement ok | ||
create table t1 (row_id int, uid int, v int, created_at timestamp with time zone); | ||
|
||
statement ok | ||
insert into t1 values | ||
(1, 1, 4, '2022-01-01 10:00:00Z'), | ||
(2, 3, 3, '2022-01-01 10:05:00Z'), | ||
(3, 2, 2, '2022-01-01 10:14:00Z'), | ||
(4, 1, 1, '2022-01-01 10:22:00Z'), | ||
(5, 3, 5, '2022-01-01 10:33:00Z'), | ||
(6, 2, 7, '2022-01-01 10:42:00Z'), | ||
(7, 1, 6, '2022-01-01 10:51:00Z'), | ||
(8, 3, 8, '2022-01-01 11:02:00Z'); | ||
|
||
query IITTT | ||
select row_id, uid, created_at, window_start, window_end | ||
from tumble(t1, created_at, interval '30' minute) order by row_id, window_start; | ||
---- | ||
1 1 2022-01-01 10:00:00+00:00 2022-01-01 10:00:00+00:00 2022-01-01 10:30:00+00:00 | ||
2 3 2022-01-01 10:05:00+00:00 2022-01-01 10:00:00+00:00 2022-01-01 10:30:00+00:00 | ||
3 2 2022-01-01 10:14:00+00:00 2022-01-01 10:00:00+00:00 2022-01-01 10:30:00+00:00 | ||
4 1 2022-01-01 10:22:00+00:00 2022-01-01 10:00:00+00:00 2022-01-01 10:30:00+00:00 | ||
5 3 2022-01-01 10:33:00+00:00 2022-01-01 10:30:00+00:00 2022-01-01 11:00:00+00:00 | ||
6 2 2022-01-01 10:42:00+00:00 2022-01-01 10:30:00+00:00 2022-01-01 11:00:00+00:00 | ||
7 1 2022-01-01 10:51:00+00:00 2022-01-01 10:30:00+00:00 2022-01-01 11:00:00+00:00 | ||
8 3 2022-01-01 11:02:00+00:00 2022-01-01 11:00:00+00:00 2022-01-01 11:30:00+00:00 | ||
|
||
query IITTT | ||
select row_id, uid, created_at, window_start, window_end | ||
from hop(t1, created_at, interval '15' minute, interval '30' minute) order by row_id, window_start; | ||
---- | ||
1 1 2022-01-01 10:00:00+00:00 2022-01-01 09:45:00+00:00 2022-01-01 10:15:00+00:00 | ||
1 1 2022-01-01 10:00:00+00:00 2022-01-01 10:00:00+00:00 2022-01-01 10:30:00+00:00 | ||
2 3 2022-01-01 10:05:00+00:00 2022-01-01 09:45:00+00:00 2022-01-01 10:15:00+00:00 | ||
2 3 2022-01-01 10:05:00+00:00 2022-01-01 10:00:00+00:00 2022-01-01 10:30:00+00:00 | ||
3 2 2022-01-01 10:14:00+00:00 2022-01-01 09:45:00+00:00 2022-01-01 10:15:00+00:00 | ||
3 2 2022-01-01 10:14:00+00:00 2022-01-01 10:00:00+00:00 2022-01-01 10:30:00+00:00 | ||
4 1 2022-01-01 10:22:00+00:00 2022-01-01 10:00:00+00:00 2022-01-01 10:30:00+00:00 | ||
4 1 2022-01-01 10:22:00+00:00 2022-01-01 10:15:00+00:00 2022-01-01 10:45:00+00:00 | ||
5 3 2022-01-01 10:33:00+00:00 2022-01-01 10:15:00+00:00 2022-01-01 10:45:00+00:00 | ||
5 3 2022-01-01 10:33:00+00:00 2022-01-01 10:30:00+00:00 2022-01-01 11:00:00+00:00 | ||
6 2 2022-01-01 10:42:00+00:00 2022-01-01 10:15:00+00:00 2022-01-01 10:45:00+00:00 | ||
6 2 2022-01-01 10:42:00+00:00 2022-01-01 10:30:00+00:00 2022-01-01 11:00:00+00:00 | ||
7 1 2022-01-01 10:51:00+00:00 2022-01-01 10:30:00+00:00 2022-01-01 11:00:00+00:00 | ||
7 1 2022-01-01 10:51:00+00:00 2022-01-01 10:45:00+00:00 2022-01-01 11:15:00+00:00 | ||
8 3 2022-01-01 11:02:00+00:00 2022-01-01 10:45:00+00:00 2022-01-01 11:15:00+00:00 | ||
8 3 2022-01-01 11:02:00+00:00 2022-01-01 11:00:00+00:00 2022-01-01 11:30:00+00:00 | ||
|
||
query IT | ||
select sum(v), window_start | ||
from tumble(t1, created_at, interval '30' minute) | ||
group by window_start order by window_start; | ||
---- | ||
10 2022-01-01 10:00:00+00:00 | ||
18 2022-01-01 10:30:00+00:00 | ||
8 2022-01-01 11:00:00+00:00 | ||
|
||
query IIT | ||
select uid, sum(v), window_start | ||
from tumble(t1, created_at, interval '30' minute) | ||
group by window_start, uid order by window_start, uid; | ||
---- | ||
1 5 2022-01-01 10:00:00+00:00 | ||
2 2 2022-01-01 10:00:00+00:00 | ||
3 3 2022-01-01 10:00:00+00:00 | ||
1 6 2022-01-01 10:30:00+00:00 | ||
2 7 2022-01-01 10:30:00+00:00 | ||
3 5 2022-01-01 10:30:00+00:00 | ||
3 8 2022-01-01 11:00:00+00:00 | ||
|
||
query IT | ||
select sum(v), window_start | ||
from hop(t1, created_at, interval '15' minute, interval '30' minute) | ||
group by window_start order by window_start; | ||
---- | ||
9 2022-01-01 09:45:00+00:00 | ||
10 2022-01-01 10:00:00+00:00 | ||
13 2022-01-01 10:15:00+00:00 | ||
18 2022-01-01 10:30:00+00:00 | ||
14 2022-01-01 10:45:00+00:00 | ||
8 2022-01-01 11:00:00+00:00 | ||
|
||
query IIT | ||
select uid, sum(v), window_start | ||
from hop(t1, created_at, interval '15' minute, interval '30' minute) | ||
group by window_start, uid order by window_start, uid; | ||
---- | ||
1 4 2022-01-01 09:45:00+00:00 | ||
2 2 2022-01-01 09:45:00+00:00 | ||
3 3 2022-01-01 09:45:00+00:00 | ||
1 5 2022-01-01 10:00:00+00:00 | ||
2 2 2022-01-01 10:00:00+00:00 | ||
3 3 2022-01-01 10:00:00+00:00 | ||
1 1 2022-01-01 10:15:00+00:00 | ||
2 7 2022-01-01 10:15:00+00:00 | ||
3 5 2022-01-01 10:15:00+00:00 | ||
1 6 2022-01-01 10:30:00+00:00 | ||
2 7 2022-01-01 10:30:00+00:00 | ||
3 5 2022-01-01 10:30:00+00:00 | ||
1 6 2022-01-01 10:45:00+00:00 | ||
3 8 2022-01-01 10:45:00+00:00 | ||
3 8 2022-01-01 11:00:00+00:00 | ||
|
||
statement error | ||
select * from hop(t1, created_at, interval '0', interval '1'); | ||
|
||
statement error | ||
select * from hop(t1, created_at, interval '1', interval '-1'); | ||
|
||
statement error | ||
select * from hop(t1, created_at, interval '-1', interval '1'); | ||
|
||
statement error | ||
select * from hop(t1, created_at, interval '-1', interval '-1'); | ||
|
||
statement ok | ||
drop table t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.