Skip to content

Commit

Permalink
Merge branch 'main' into chore/alter-show-cluster-cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
yezizp2012 authored Jul 14, 2023
2 parents 8c5ef9d + 88ecdf8 commit 437d265
Show file tree
Hide file tree
Showing 119 changed files with 2,693 additions and 831 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/assign-issue-milestone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,3 @@ jobs:
version-prefix: 'release-'
version-separator: '.'
overwrite: false
- name: Add issue to project
uses: actions/[email protected]
with:
project-url: https:/orgs/risingwavelabs/projects/13
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docker/dashboards/risingwave-dev-dashboard.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docker/dashboards/risingwave-user-dashboard.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion e2e_test/batch/distribution_mode.slt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ SET RW_IMPLICIT_FLUSH TO true;
statement ok
SET QUERY_MODE TO distributed;


include ./basic/*.slt.part
include ./duckdb/all.slt.part
include ./order/*.slt.part
Expand All @@ -13,6 +12,7 @@ include ./join/*/*.slt.part
include ./aggregate/*.slt.part
include ./types/*.slt.part
include ./functions/*.slt.part
include ./over_window/main.slt.part

statement ok
SET QUERY_MODE TO auto;
1 change: 1 addition & 0 deletions e2e_test/batch/local_mode.slt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ include ./aggregate/*.slt.part
include ./types/*.slt.part
include ./catalog/*.slt.part
include ./functions/*.slt.part
include ./over_window/main.slt.part

statement ok
SET QUERY_MODE TO auto;
Expand Down
5 changes: 5 additions & 0 deletions e2e_test/batch/over_window/main.slt.part
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
statement ok
SET RW_IMPLICIT_FLUSH TO true;

include ./special_cases/mod.slt.part
include ./over_window/mod.slt.part
1 change: 1 addition & 0 deletions e2e_test/batch/over_window/over_window
1 change: 1 addition & 0 deletions e2e_test/batch/over_window/special_cases/mod.slt.part
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ./to_agg_then_join.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ statement ok
create table t(x int, y int);

statement ok
insert into t values
insert into t values
(1, 1), (1, 2), (1, 3), (1, 4), (1, 5),
(2, 1), (2, 2), (2, 3), (2, 4), (2, 5),
(3, 1), (3, 2), (3, 3), (3, 4), (3, 5),
Expand Down
54 changes: 54 additions & 0 deletions e2e_test/batch/transaction/now.slt.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Disabled, see https:/risingwavelabs/risingwave/issues/10887

statement ok
create table t (ts timestamp);

statement ok
create view v as select * from t where ts at time zone 'utc' >= now();

statement ok
create materialized view mv as select * from v;

statement ok
insert into t select * from generate_series(
now() at time zone 'utc' - interval '10' second,
now() at time zone 'utc' + interval '20' second,
interval '1' second / 20
);

statement ok
flush;

statement ok
start transaction read only;

# the view should not be empty, so that the following check is meaningful
query T
select count(*) > 0 from mv;
----
t

# the result from batch query and materialized view should be the same
query T
select * from v
except
select * from mv;
----

query T
select * from mv
except
select * from v;
----

statement ok
commit;

statement ok
drop materialized view mv;

statement ok
drop view v;

statement ok
drop table t;
1 change: 1 addition & 0 deletions e2e_test/over_window/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please run `gen.py` after modifying SLT template files in `templates`.
43 changes: 43 additions & 0 deletions e2e_test/over_window/gen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python3

import os
import shutil
from os import path
from string import Template

cd = path.dirname(path.abspath(__file__))
templates_dir = path.join(cd, "templates")
generated_dir = path.join(cd, "generated")

contexts = {
"batch": {
"view_type": "view",
},
"streaming": {
"view_type": "materialized view",
},
}

file_head = """# This file is generated by `gen.py`. Do not edit it manually!"""

for mode in contexts.keys():
mode_dir = path.join(generated_dir, mode)
shutil.rmtree(mode_dir)
os.makedirs(mode_dir, exist_ok=True)

for file in os.listdir(templates_dir):
if not file.endswith(".slt") and not file.endswith(".slt.part"):
continue

print(f"Generating `{file}`...")

with open(path.join(templates_dir, file), "r") as f:
tpl = Template(f.read())

for mode, context in contexts.items():
out_file = path.join(generated_dir, mode, file)
with open(out_file, "w") as f:
f.write(file_head + "\n\n")
f.write(tpl.safe_substitute(context))

print("Done.")
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is generated by `gen.py`. Do not edit it manually!

statement ok
create table t (
id int
Expand All @@ -10,25 +12,25 @@ create table t (

# simple and basic `first_value` call
statement ok
create materialized view mv_a as
create view v_a as
select
*
, first_value(v1) over (partition by p1, p2 order by time, id rows 3 preceding) as out1
from t;

# multiple aggregate calls with unbounded frames
statement ok
create materialized view mv_b as
create view v_b as
select
*
, avg(v1) over (partition by p1) as out2
, sum(v1) over (partition by p1, p2 order by time rows between unbounded preceding and current row) as out3
, min(v1) over (partition by p1, p2 order by time rows between current row and unbounded following) as out4
, sum(v1) over (partition by p1, p2 order by time, id rows between unbounded preceding and current row) as out3
, min(v1) over (partition by p1, p2 order by time, id rows between current row and unbounded following) as out4
from t;

# lag and lead
statement ok
create materialized view mv_c as
create view v_c as
select
*
, lag(v1, 0) over (partition by p1 order by id) as out5
Expand All @@ -40,24 +42,24 @@ from t;

# row_number
statement ok
create materialized view mv_d as
create view v_d as
select
*
, row_number() over (partition by p1 order by time, id) as out10
, row_number() over (partition by p1 order by p2 desc, id) as out11
from t;

statement ok
create materialized view mv_a_b as
create view v_a_b as
select
*
, first_value(v1) over (partition by p1, p2 order by time, id rows 3 preceding) as out1
, sum(v1) over (partition by p1, p2 order by time rows between unbounded preceding and current row) as out3
, min(v1) over (partition by p1, p2 order by time rows between current row and unbounded following) as out4
, sum(v1) over (partition by p1, p2 order by time, id rows between unbounded preceding and current row) as out3
, min(v1) over (partition by p1, p2 order by time, id rows between current row and unbounded following) as out4
from t;

statement ok
create materialized view mv_a_c as
create view v_a_c as
select
*
, first_value(v1) over (partition by p1, p2 order by time, id rows 3 preceding) as out1
Expand All @@ -67,24 +69,24 @@ select
from t;

statement ok
create materialized view mv_b_c as
create view v_b_c as
select
*
, sum(v1) over (partition by p1, p2 order by time rows between unbounded preceding and current row) as out3
, min(v1) over (partition by p1, p2 order by time rows between current row and unbounded following) as out4
, sum(v1) over (partition by p1, p2 order by time, id rows between unbounded preceding and current row) as out3
, min(v1) over (partition by p1, p2 order by time, id rows between current row and unbounded following) as out4
, lag(v1) over (partition by p1, p2 order by time, id) as out7
, lead(v2, 1) over (partition by p1, p2 order by time, id) as out8
, lead(v2, 2) over (partition by p1, p2 order by v1, v2) as out9
from t;

statement ok
create materialized view mv_a_b_c as
create view v_a_b_c as
select
*
, first_value(v1) over (partition by p1, p2 order by time, id rows 3 preceding) as out1
, avg(v1) over (partition by p1) as out2
, sum(v1) over (partition by p1, p2 order by time rows between unbounded preceding and current row) as out3
, min(v1) over (partition by p1, p2 order by time rows between current row and unbounded following) as out4
, sum(v1) over (partition by p1, p2 order by time, id rows between unbounded preceding and current row) as out3
, min(v1) over (partition by p1, p2 order by time, id rows between current row and unbounded following) as out4
, lag(v1, 0) over (partition by p1 order by id) as out5
, lag(v1, 1) over (partition by p1, p2 order by id) as out6
, lag(v1) over (partition by p1, p2 order by time, id) as out7
Expand Down
42 changes: 42 additions & 0 deletions e2e_test/over_window/generated/batch/cross_check.slt.part
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This file is generated by `gen.py`. Do not edit it manually!

# result should be empty, which means output in v_a_b all equal to v_a and v_b
query i
select
id, out1, out3, out4
from v_a_b
except
select
id, out1, out3, out4
from v_a natural join v_b;
----

query i
select
id, out1, out7, out8, out9
from v_a_c
except
select
id, out1, out7, out8, out9
from v_a natural join v_c;
----

query i
select
id, out3, out4, out7, out8, out9
from v_b_c
except
select
id, out3, out4, out7, out8, out9
from v_b natural join v_c;
----

query i
select
id, out1, out2, out3, out4, out5, out6, out7, out8, out9
from v_a_b_c
except
select
id, out1, out2, out3, out4, out5, out6, out7, out8, out9
from v_a natural join v_b natural join v_c;
----
28 changes: 28 additions & 0 deletions e2e_test/over_window/generated/batch/drop.slt.part
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file is generated by `gen.py`. Do not edit it manually!

statement ok
drop view v_a;

statement ok
drop view v_b;

statement ok
drop view v_c;

statement ok
drop view v_d;

statement ok
drop view v_a_b;

statement ok
drop view v_b_c;

statement ok
drop view v_a_c;

statement ok
drop view v_a_b_c;

statement ok
drop table t;
Loading

0 comments on commit 437d265

Please sign in to comment.