Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stream,agg): support array_agg for streaming mode #4895

Merged
merged 6 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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