Skip to content

Commit

Permalink
feat(common): support NULLS {FIRST | LAST} (risingwavelabs#8485)
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Chien <[email protected]>
  • Loading branch information
stdrc authored Mar 19, 2023
1 parent 6940ae4 commit 41323a9
Show file tree
Hide file tree
Showing 37 changed files with 1,199 additions and 904 deletions.
51 changes: 46 additions & 5 deletions dashboard/proto/gen/common.ts

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

128 changes: 0 additions & 128 deletions dashboard/proto/gen/order.ts

This file was deleted.

23 changes: 13 additions & 10 deletions e2e_test/batch/aggregate/array_agg.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ statement ok
SET RW_IMPLICIT_FLUSH TO true;

statement ok
create table t(v1 varchar, v2 int, v3 int)
create table t(v1 varchar, v2 int, v3 int);

query T
select array_agg(v1) from t;
Expand All @@ -18,10 +18,7 @@ select array_agg(v1) from t;
{NULL}

statement ok
delete from t;

statement ok
insert into t values ('aaa', 1, 1), ('bbb', 0, 2), ('ccc', 0, 5), ('ddd', 1, 4)
insert into t values ('aaa', 1, 1), ('bbb', 0, 2), ('ccc', 0, 5), ('ddd', 1, 4);

query T
select b from (select unnest(a) from (select array_agg(v3) as v3_arr from t) g(a)) p(b) order by b;
Expand All @@ -30,16 +27,22 @@ select b from (select unnest(a) from (select array_agg(v3) as v3_arr from t) g(a
2
4
5
NULL

query T
select array_agg(v1 order by v3 asc nulls first) from t;
----
{NULL,aaa,bbb,ddd,ccc}

query T
select array_agg(v1 order by v3 desc) from t
select array_agg(v1 order by v3 desc) from t;
----
{ccc,ddd,bbb,aaa}
{NULL,ccc,ddd,bbb,aaa}

query T
select array_agg(v1 order by v2 asc, v3 desc) from t
select array_agg(v1 order by v2 asc nulls last, v3 desc) from t;
----
{ccc,bbb,ddd,aaa}
{ccc,bbb,ddd,aaa,NULL}

statement ok
drop table t
drop table t;
59 changes: 53 additions & 6 deletions e2e_test/batch/basic/index.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ statement ok
create index idx2 on t1(v2);

statement ok
insert into t1 values(1, 2),(3,4),(5,6);
insert into t1 values (1, 2), (3, 4), (5, 6);

statement ok
explain select v1,v2 from t1 where v1 = 1;
explain select v1, v2 from t1 where v1 = 1;

query II
select v1,v2 from t1 where v1 = 1;
select v1, v2 from t1 where v1 = 1;
----
1 2

query II
select v1,v2 from t1 where v2 = 4;
select v1, v2 from t1 where v2 = 4;
----
3 4

query II
select v1,v2 from t1 where v1 = 1 or v2 = 4 order by v1, v2;
select v1, v2 from t1 where v1 = 1 or v2 = 4 order by v1, v2;
----
1 2
3 4
Expand All @@ -36,10 +36,57 @@ statement ok
delete from t1 where v1 = 1;

query II
select v1,v2 from t1 order by v1, v2;
select v1, v2 from t1 order by v1, v2;
----
3 4
5 6

statement ok
insert into t1 values (NULL, 5);

statement ok
create index idx3 on t1(v1 desc);

statement ok
create index idx4 on t1(v1 nulls first);

statement ok
create index idx5 on t1(v1 desc nulls last);

query II
select v1, v2 from t1 order by v1;
----
3 4
5 6
NULL 5

query II
select v1, v2 from t1 order by v1 desc;
----
NULL 5
5 6
3 4

query II
select v1, v2 from t1 order by v1 asc nulls first;
----
NULL 5
3 4
5 6

query II
select v1, v2 from t1 order by v1 desc nulls last;
----
5 6
3 4
NULL 5

query II
select v1, v2 from t1 order by v1 desc nulls first;
----
NULL 5
5 6
3 4

statement ok
drop table t1;
Loading

0 comments on commit 41323a9

Please sign in to comment.