Skip to content

Commit

Permalink
feat(stream,agg): support array_agg for streaming mode (#4895)
Browse files Browse the repository at this point in the history
* remove a outdated todo

Signed-off-by: Richard Chien <[email protected]>

* support streaming array_agg

Signed-off-by: Richard Chien <[email protected]>

* add unittest

Signed-off-by: Richard Chien <[email protected]>

* considering NULL value

Signed-off-by: Richard Chien <[email protected]>

* add e2e test for streaming array_agg

Signed-off-by: Richard Chien <[email protected]>

Signed-off-by: Richard Chien <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
stdrc and mergify[bot] authored Aug 25, 2022
1 parent 61021b8 commit 2cdbb11
Show file tree
Hide file tree
Showing 4 changed files with 635 additions and 7 deletions.
57 changes: 57 additions & 0 deletions e2e_test/streaming/array_agg.slt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
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 array_agg(c) as res from t;

statement ok
create materialized view mv2 as select array_agg(a order by b asc, a desc) as res from t;

statement ok
flush;

query T
select u from (select unnest(res) from mv1) p(u) order by u;
----
1
2
4
5

query T
select * from mv2;
----
{ccc,bbb,ddd,aaa}

statement ok
insert into t values ('x', 1, 2), ('y', 3, 6);

query T
select u from (select unnest(res) from mv1) p(u) order by u;
----
1
2
2
4
5
6

query T
select * from mv2;
----
{ccc,bbb,x,ddd,aaa,y}

statement ok
drop materialized view mv1;

statement ok
drop materialized view mv2;

statement ok
drop table t;
1 change: 0 additions & 1 deletion src/frontend/src/optimizer/plan_node/logical_agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ impl LogicalAgg {
table_catalogs.push(state_table);
column_mappings_vec.push(column_mapping);
}
// TODO: fill column mapping later (#3485).
(table_catalogs, column_mappings_vec)
}

Expand Down
Loading

0 comments on commit 2cdbb11

Please sign in to comment.