forked from risingwavelabs/risingwave
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add range table function (risingwavelabs#6646)
feat: Add table function Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
1b4cfdb
commit 04514b8
Showing
3 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
File renamed without changes.
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,84 @@ | ||
statement ok | ||
SET RW_IMPLICIT_FLUSH TO true; | ||
|
||
query I | ||
select * from range('2008-03-01 00:00:00'::TIMESTAMP,'2008-03-04 12:00:00'::TIMESTAMP, interval '12' hour) | ||
---- | ||
2008-03-01 00:00:00 | ||
2008-03-01 12:00:00 | ||
2008-03-02 00:00:00 | ||
2008-03-02 12:00:00 | ||
2008-03-03 00:00:00 | ||
2008-03-03 12:00:00 | ||
2008-03-04 00:00:00 | ||
|
||
query I | ||
select * from range(timestamp '2020-01-01 01:02:03', timestamp '2021-01-01 03:04:05', interval '1' month); | ||
---- | ||
2020-01-01 01:02:03 | ||
2020-02-01 01:02:03 | ||
2020-03-01 01:02:03 | ||
2020-04-01 01:02:03 | ||
2020-05-01 01:02:03 | ||
2020-06-01 01:02:03 | ||
2020-07-01 01:02:03 | ||
2020-08-01 01:02:03 | ||
2020-09-01 01:02:03 | ||
2020-10-01 01:02:03 | ||
2020-11-01 01:02:03 | ||
2020-12-01 01:02:03 | ||
2021-01-01 01:02:03 | ||
|
||
query I | ||
select * from range(timestamp '2021-01-01 03:04:05', timestamp '2020-01-01 01:02:03', interval '1' month-interval '60' day); | ||
---- | ||
2021-01-01 03:04:05 | ||
2020-12-03 03:04:05 | ||
2020-11-04 03:04:05 | ||
2020-10-05 03:04:05 | ||
2020-09-06 03:04:05 | ||
2020-08-07 03:04:05 | ||
2020-07-09 03:04:05 | ||
2020-06-10 03:04:05 | ||
2020-05-11 03:04:05 | ||
2020-04-12 03:04:05 | ||
2020-03-13 03:04:05 | ||
2020-02-13 03:04:05 | ||
2020-01-13 03:04:05 | ||
|
||
query I | ||
SELECT * FROM range('2'::INT,'10'::INT,'2'::INT) | ||
---- | ||
2 | ||
4 | ||
6 | ||
8 | ||
|
||
query I | ||
SELECT * FROM range('2'::INT + '2'::INT,'10'::INT,'2'::INT); | ||
---- | ||
4 | ||
6 | ||
8 | ||
|
||
query I | ||
SELECT * FROM range('2'::INT + '2'::INT,'10'::INT,'2'::INT); | ||
---- | ||
4 | ||
6 | ||
8 | ||
|
||
query I | ||
SELECT * FROM range('10'::INT,'2'::INT,'-2'::INT); | ||
---- | ||
10 | ||
8 | ||
6 | ||
4 | ||
|
||
statement error | ||
SELECT * FROM range('2'::INT,'10'::INT,'0'::INT); | ||
|
||
query I | ||
SELECT * FROM range('2'::INT,'10'::INT,'-2'::INT); | ||
---- |
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