Skip to content

Commit

Permalink
fix(common): fix memcomparable encoding for list (#4599)
Browse files Browse the repository at this point in the history
* add has_remaining

* fix list_array

* fix serialize

* better error message

* enable order by test for struct/list

* add e2e tests

* remove has_fixed_length sincei it is not needed

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
wzzzzd and mergify[bot] authored Aug 12, 2022
1 parent b37d329 commit bb66ea8
Show file tree
Hide file tree
Showing 8 changed files with 375 additions and 234 deletions.
1 change: 1 addition & 0 deletions e2e_test/batch/distribution_mode.slt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SET QUERY_MODE TO distributed;


include ./basic/*.slt.part
include ./order/*.slt.part
include ./join/*.slt.part
include ./join/*/*.slt.part
include ./aggregate/*.slt.part
Expand Down
1 change: 1 addition & 0 deletions e2e_test/batch/local_mode.slt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SET QUERY_MODE TO local;

include ./basic/*.slt.part
include ./basic/local/*.slt.part
include ./order/*.slt.part
include ./join/*.slt.part
include ./join/*/*.slt.part
include ./aggregate/*.slt.part
Expand Down
70 changes: 70 additions & 0 deletions e2e_test/batch/order/test_order_list.slt.part
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
statement ok
SET RW_IMPLICIT_FLUSH TO true;

statement ok
create table t (a int[]);

statement ok
insert into t values (array[1]), (array[2]), (array[1, 2, 3]), (NULL), (array[1, NULL]);

query T
select * from t order by 1;
----
{1}
{1,2,3}
{1,NULL}
{2}
NULL

statement ok
drop table t;

statement ok
create table t (a int[][]);

statement ok
insert into t values (array[array[1, 2, 3], array[2]]), (array[array[1], array[2, 3, 2]]), (array[array[2], array[1]]);

query T
select * from t order by 1;
----
{{1},{2,3,2}}
{{1,2,3},{2}}
{{2},{1}}

statement ok
drop table t;

statement ok
create table t (a int[], b int);

statement ok
insert into t values (array[1, 2], 3), (array[1], NULL), (array[1], 3), (array[2], 1);

query TI
select * from t order by 1 ASC, 2 DESC;
----
{1} NULL
{1} 3
{1,2} 3
{2} 1

statement ok
drop table t;

statement ok
create table t (a varchar[][]);

statement ok
insert into t values (array[array['abc', 'd'], array['ef']]), (array[array['a', 'bcd'], array['e', 'f']]), (array[array['abc', 'd'], array['e', 'f']]), (array[array['b'], array['c']]);

query T
select * from t order by 1 DESC;
----
{{b},{c}}
{{abc,d},{ef}}
{{abc,d},{e,f}}
{{a,bcd},{e,f}}

statement ok
drop table t;
38 changes: 38 additions & 0 deletions e2e_test/batch/order/test_order_struct.slt.part
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
statement ok
SET RW_IMPLICIT_FLUSH TO true;

statement ok
create table t (a struct<v1 int, v2 int>);

statement ok
insert into t values ((1, 2)), ((1, 3)), ((1, NULL)), ((2, 1)), ((2, 2)), ((NULL, NULL));

query II
select * from t order by 1;
----
(1,2)
(1,3)
(1,NULL)
(2,1)
(2,2)
(NULL,NULL)

statement ok
drop table t;

statement ok
create table t (v1 struct<v1 varchar, v2 struct<v1 varchar, v2 int> >, v2 int);

statement ok
insert into t values (('abc',('bcd',2)),1), (('abc',('bcd',2)),2), (('a',('bcbcd',2)),2), (('b',('a',2)),2);

query TTII
select * from t order by 1 DESC, 2 ASC;
----
(b,(a,2)) 2
(abc,(bcd,2)) 1
(abc,(bcd,2)) 2
(a,(bcbcd,2)) 2

statement ok
drop table t;
Loading

0 comments on commit bb66ea8

Please sign in to comment.