-
Notifications
You must be signed in to change notification settings - Fork 590
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Richard Chien <[email protected]>
- Loading branch information
Showing
27 changed files
with
838 additions
and
139 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
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,48 @@ | ||
# In madsim test, we cannot spawn process. | ||
skipif madsim | ||
# In parallel test, we cannot get the DB name. | ||
skipif parallel | ||
# TODO: Later if we introduce a new `now()`-like function that returns the time of statement execution, | ||
# we'll be able to directly create MV without `./risedev psql` and so that we can remove these `skipif`. | ||
system ok | ||
./risedev psql -c " | ||
create materialized view mv as | ||
select * from generate_series( | ||
to_timestamp($(date +%s)) - interval '10 second', | ||
now(), | ||
interval '1 second' | ||
); | ||
" | ||
|
||
skipif madsim | ||
skipif parallel | ||
statement ok | ||
flush; | ||
|
||
skipif madsim | ||
skipif parallel | ||
query I | ||
select count(*) >= 10 from mv; | ||
---- | ||
t | ||
|
||
skipif madsim | ||
skipif parallel | ||
sleep 2s | ||
|
||
skipif madsim | ||
skipif parallel | ||
statement ok | ||
flush; | ||
|
||
skipif madsim | ||
skipif parallel | ||
query I | ||
select count(*) >= 12 from mv; | ||
---- | ||
t | ||
|
||
skipif madsim | ||
skipif parallel | ||
statement ok | ||
drop materialized view mv; |
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
30 changes: 30 additions & 0 deletions
30
src/frontend/planner_test/tests/testdata/input/generate_series_with_now.yaml
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,30 @@ | ||
- sql: | | ||
select * from generate_series( | ||
'2024-06-21 17:36:00'::timestamptz, | ||
now(), | ||
interval '1 hour' | ||
); | ||
expected_outputs: | ||
- logical_plan | ||
- optimized_logical_plan_for_stream | ||
- stream_plan | ||
- sql: | | ||
select * from generate_series( | ||
'2024-06-21 17:36:00'::timestamp, -- `timestamp` type is not supported | ||
now(), | ||
interval '1 hour' | ||
); | ||
expected_outputs: | ||
- binder_error | ||
- sql: | | ||
select * from generate_series( | ||
now() - interval '1 hour', | ||
now(), | ||
interval '1 hour' | ||
); | ||
expected_outputs: | ||
- stream_error | ||
- sql: | | ||
select * from unnest(array[now(), now()]); | ||
expected_outputs: | ||
- stream_error |
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
35 changes: 35 additions & 0 deletions
35
src/frontend/planner_test/tests/testdata/output/generate_series_with_now.yaml
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,35 @@ | ||
# This file is automatically generated. See `src/frontend/planner_test/README.md` for more information. | ||
- sql: | | ||
select * from generate_series( | ||
'2024-06-21 17:36:00'::timestamptz, | ||
now(), | ||
interval '1 hour' | ||
); | ||
logical_plan: |- | ||
LogicalProject { exprs: [generate_series] } | ||
└─LogicalTableFunction { table_function: GenerateSeries('2024-06-21 17:36:00':Varchar::Timestamptz, Now, '01:00:00':Interval) } | ||
optimized_logical_plan_for_stream: 'LogicalNow { output: [ts] }' | ||
stream_plan: |- | ||
StreamMaterialize { columns: [generate_series], stream_key: [generate_series], pk_columns: [generate_series], pk_conflict: NoCheck, watermark_columns: [generate_series] } | ||
└─StreamNow { output: [ts] } | ||
- sql: | | ||
select * from generate_series( | ||
'2024-06-21 17:36:00'::timestamp, -- `timestamp` type is not supported | ||
now(), | ||
interval '1 hour' | ||
); | ||
binder_error: function generate_series(timestamp without time zone, timestamp with time zone, interval) does not exist | ||
- sql: | | ||
select * from generate_series( | ||
now() - interval '1 hour', | ||
now(), | ||
interval '1 hour' | ||
); | ||
stream_error: |- | ||
Not supported: General `now()` function in streaming queries | ||
HINT: Streaming `now()` is currently only supported in GenerateSeries and TemporalFilter patterns. | ||
- sql: | | ||
select * from unnest(array[now(), now()]); | ||
stream_error: |- | ||
Not supported: General `now()` function in streaming queries | ||
HINT: Streaming `now()` is currently only supported in GenerateSeries and TemporalFilter patterns. |
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.