toColumnarTuple
Syntax
toColumnarTuple(X)
Details
Use with GROUP BY to group by and convert X into a columnar tuple. The function does not work when used alone.
Parameters
X is a column name or an expression on column(s).
Returns
A columnar tuple.
Examples
t = table([`AAPL, `AAPL, `GOOG, `GOOG, `MSFT, `MSFT] as symbol,
[182.5, 183.2, 145.8, 146.5, 412.3, 411.8] as price)
t
| symbol | price |
|---|---|
| AAPL | 182.5 |
| AAPL | 183.2 |
| GOOG | 145.8 |
| GOOG | 146.5 |
| MSFT | 412.3 |
| MSFT | 411.8 |
Use toColumnarTuple to group by stock and aggregate all prices. The
aggregated price column is a columnar tuple.
result = select toColumnarTuple(price) as prices from t group by symbol
result
| symbol | prices |
|---|---|
| AAPL | [182.5, 183.2] |
| GOOG | [145.8, 146.5] |
| MSFT | [412.3, 411.8] |
