toArray

Syntax

toArray(X)

Details

Use with GROUP BY to aggregate grouped data into an array vector. The function does not work when used alone.

Parameters

X is a column name or an expression on column(s).

Returns

An array vector with the same data type as X.

Examples

t = table(1 1 3 4 as id, 1 3 5 6 as v1)
new_t = select toArray(v1) as newV1 from t group by id
/* 
id newV1
-- -----
1  [1,3]
3  [5]  
4  [6]  
*/


new_t = select toArray(v1+1) as newV1 from t group by id
/* 
id newV1
-- -----
1  [2,4]
3  [6]  
4  [7]  
*/

Related Functions: toColumnarTuple, toTuple