-
Notifications
You must be signed in to change notification settings - Fork 592
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
jsonb_agg
and jsonb_object_agg
in streaming mo…
…de (#12836) Signed-off-by: Richard Chien <[email protected]>
- Loading branch information
Showing
4 changed files
with
66 additions
and
9 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,46 @@ | ||
statement ok | ||
SET RW_IMPLICIT_FLUSH TO true; | ||
|
||
statement ok | ||
create table t(v1 boolean, v2 int, v3 varchar, v4 jsonb); | ||
|
||
statement ok | ||
create materialized view mv_tmp as | ||
select jsonb_agg(v1) as j1 from t; | ||
|
||
statement ok | ||
drop materialized view mv_tmp; | ||
|
||
statement ok | ||
create materialized view mv1 as | ||
select | ||
jsonb_agg(v1 order by v2) as j1, | ||
jsonb_agg(v2 order by v2) as j2, | ||
jsonb_object_agg(v3, v4) as j3 | ||
from t; | ||
|
||
statement ok | ||
insert into t values | ||
(null, 2, 'bbb', null), | ||
(false, 1, 'ccc', 'null'); | ||
|
||
query TTT | ||
select * from mv1; | ||
---- | ||
[false, null] [1, 2] {"bbb": null, "ccc": null} | ||
|
||
statement ok | ||
insert into t values | ||
(true, 0, 'bbb', '999'), | ||
(true, 8, 'ddd', '{"foo": "bar"}'); | ||
|
||
query TTT | ||
select * from mv1; | ||
---- | ||
[true, false, null, true] [0, 1, 2, 8] {"bbb": 999, "ccc": null, "ddd": {"foo": "bar"}} | ||
|
||
statement ok | ||
drop materialized view mv1; | ||
|
||
statement ok | ||
drop table t; |
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