-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(agg): support
aggregate:
prefixed scalar function in streaming…
… agg (#18205) Signed-off-by: Richard Chien <stdrc@outlook.com>
- Loading branch information
Showing
4 changed files
with
91 additions
and
16 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,62 @@ | ||
statement ok | ||
SET RW_IMPLICIT_FLUSH TO true; | ||
|
||
statement ok | ||
create table t (a varchar, b int, c int); | ||
|
||
statement ok | ||
insert into t values ('aaa', 1, 1), ('bbb', 0, 2), ('ccc', 0, 5), ('ddd', 1, 4); | ||
|
||
statement ok | ||
create materialized view mv1 as select aggregate:array_sum(c) as res from t; | ||
|
||
statement ok | ||
create materialized view mv2 as select b, aggregate:array_max(c) as res from t group by b; | ||
|
||
statement ok | ||
create function myjoin(text[]) returns text language sql as $$ select array_join($1, ', '); $$; | ||
|
||
statement ok | ||
create materialized view mv3 as select b, aggregate:myjoin(a order by c) as res from t group by b; | ||
|
||
query I | ||
select * from mv1; | ||
---- | ||
12 | ||
|
||
query II | ||
select * from mv2 order by b; | ||
---- | ||
0 5 | ||
1 4 | ||
|
||
query IT | ||
select * from mv3 order by b; | ||
---- | ||
0 bbb, ccc | ||
1 aaa, ddd | ||
|
||
statement ok | ||
insert into t values ('x', 1, 2), ('y', 3, 6); | ||
|
||
query I | ||
select * from mv1; | ||
---- | ||
20 | ||
|
||
query II | ||
select * from mv2 order by b; | ||
---- | ||
0 5 | ||
1 4 | ||
3 6 | ||
|
||
query IT | ||
select * from mv3 order by b; | ||
---- | ||
0 bbb, ccc | ||
1 aaa, x, ddd | ||
3 y | ||
|
||
statement ok | ||
drop table t cascade; |
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