Skip to content

Commit 22f3288

Browse files
committed
add test
Signed-off-by: jayzhan211 <[email protected]>
1 parent eba41ae commit 22f3288

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

datafusion/sqllogictest/test_files/aggregate.slt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,36 @@ FROM
106106
----
107107
[0VVIHzxWtNOFLtnhjHEKjXaJOSLJfm, 0keZ5G8BffGwgF2RwQD59TFzMStxCB, 0og6hSkhbX8AC1ktFS4kounvTzy8Vo, 1aOcrEGd0cOqZe2I5XBOm0nDcwtBZO, 2T3wSlHdEmASmO0xcXHnndkKEt6bz8]
108108

109+
statement ok
110+
CREATE EXTERNAL TABLE agg_order (
111+
c1 INT NOT NULL,
112+
c2 INT NOT NULL,
113+
c3 INT NOT NULL
114+
)
115+
STORED AS CSV
116+
WITH HEADER ROW
117+
LOCATION '../core/tests/data/aggregate_agg_multi_order.csv';
118+
119+
# test array_agg with order by multiple columns
120+
query ?
121+
select array_agg(c1 order by c2 desc, c3) from agg_order;
122+
----
123+
[5, 6, 7, 8, 9, 1, 2, 3, 4, 10]
124+
125+
query TT
126+
explain select array_agg(c1 order by c2 desc, c3) from agg_order;
127+
----
128+
logical_plan
129+
Aggregate: groupBy=[[]], aggr=[[ARRAY_AGG(agg_order.c1) ORDER BY [agg_order.c2 DESC NULLS FIRST, agg_order.c3 ASC NULLS LAST]]]
130+
--TableScan: agg_order projection=[c1, c2, c3]
131+
physical_plan
132+
AggregateExec: mode=Final, gby=[], aggr=[ARRAY_AGG(agg_order.c1)]
133+
--CoalescePartitionsExec
134+
----AggregateExec: mode=Partial, gby=[], aggr=[ARRAY_AGG(agg_order.c1)]
135+
------SortExec: expr=[c2@1 DESC,c3@2 ASC NULLS LAST]
136+
--------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
137+
----------CsvExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/core/tests/data/aggregate_agg_multi_order.csv]]}, projection=[c1, c2, c3], has_header=true
138+
109139
statement error This feature is not implemented: LIMIT not supported in ARRAY_AGG: 1
110140
SELECT array_agg(c13 LIMIT 1) FROM aggregate_test_100
111141

0 commit comments

Comments
 (0)