You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- create table CREATETABLEIF NOT EXISTS db (
id INTNOT NULL COMMENT "unique id", -- Benzersiz bir ID sütunu eklemek iyi bir pratik
a ARRAY<INT>NULL COMMENT "Integer array column",
s ARRAY<STRING>NULL COMMENT "String array column"
)
DUPLICATE KEY(id)
DISTRIBUTED BY HASH(id) BUCKETS 10
PROPERTIES (
"replication_allocation"="tag.location.default:1"
);
-- insert data INSERT INTO db (id, a, s) VALUES
(1, [1, 2, 3], ["ab", "123"]),
(2, [20], ["cd"]),
(3, [100], ["efg"]),
(4, NULL, NULL),
(5, [null, 2], [null, "c"]);
-- call function a few times, every run will return a different combination SELECT array_agg_foreach(a) FROM db;
Aggregate functions (such as array_agg) may return results in an undefined order if no sorting rule is specified.
This happens because:
Doris executes aggregations using a parallel execution plan (pipeline + shuffle).
When results from multiple threads are merged, the order depends on runtime scheduling and partition merging.
As a result, the same input may produce aggregated arrays in different orders.
so it’s expected.
Aggregate functions (such as array_agg) may return results in an undefined order if no sorting rule is specified. This happens because: Doris executes aggregations using a parallel execution plan (pipeline + shuffle). When results from multiple threads are merged, the order depends on runtime scheduling and partition merging. As a result, the same input may produce aggregated arrays in different orders. so it’s expected.
The issue is not just the order of the results, but that the expected results are missing and different from the documentation. I think there might be a race condition. The CTE example returns the correct result.
Aggregate functions (such as array_agg) may return results in an undefined order if no sorting rule is specified. This happens because: Doris executes aggregations using a parallel execution plan (pipeline + shuffle). When results from multiple threads are merged, the order depends on runtime scheduling and partition merging. As a result, the same input may produce aggregated arrays in different orders. so it’s expected.
The issue is not just the order of the results, but that the expected results are missing and different from the documentation. I think there might be a race condition. The CTE example returns the correct result.
yes, thanks for your advice. we have fixed this. #55075
Activity
IsmailTosunTnyl commentedon Jun 29, 2025
its working fine with CTE:
When used with a table, it creates a different single element array for each query execution.
ixzc commentedon Aug 18, 2025
Aggregate functions (such as array_agg) may return results in an undefined order if no sorting rule is specified.
This happens because:
Doris executes aggregations using a parallel execution plan (pipeline + shuffle).
When results from multiple threads are merged, the order depends on runtime scheduling and partition merging.
As a result, the same input may produce aggregated arrays in different orders.
so it’s expected.
IsmailTosunTnyl commentedon Aug 18, 2025
The issue is not just the order of the results, but that the expected results are missing and different from the documentation. I think there might be a race condition. The CTE example returns the correct result.
ixzc commentedon Aug 20, 2025
yes, thanks for your advice. we have fixed this.
#55075