Open
Description
WIth DISTINCT this works
trino> SELECT array_agg(DISTINCT concat(value, value) ) csv_value
-> FROM (VALUES 'a', 'b', 'c', 'b') t(value);
csv_value
--------------
[cc, aa, bb]
with ORDER BY this works
trino> SELECT array_agg( concat(value, value) ORDER BY value) csv_value
-> FROM (VALUES 'a', 'b', 'c', 'b') t(value);
csv_value
------------------
[aa, bb, bb, cc]
(1 row)
with both DISTINCT and ORDER BY there is an error
trino> SELECT array_agg(DISTINCT concat(value, value) ORDER BY value) csv_value
-> FROM (VALUES 'a', 'b', 'c', 'b') t(value);
Query 20240215_185707_00008_3tuur failed: line 1:57: For aggregate function with DISTINCT, ORDER BY expressions must appear in arguments
SELECT array_agg(DISTINCT concat(value, value) ORDER BY *value*) csv_value ...