groupArrayLast
Syntax: groupArrayLast(max_size)(x)
Creates an array of the last argument values.
For example, groupArrayLast(1)(x) is equivalent to [anyLast (x)].
In some cases, you can still rely on the order of execution. This applies to cases when SELECT comes from a subquery that uses ORDER BY if the subquery result is small enough.
Example
Query:
Result:
In compare to groupArray:
groupArrayLast
Introduced in: v23.1
Creates an array of the last argument values.
For example, groupArrayLast(1)(x) is equivalent to [anyLast(x)].
In some cases, you can still rely on the order of execution.
This applies to cases when SELECT comes from a subquery that uses ORDER BY if the subquery result is small enough.
Syntax
Parameters
max_size— Maximum size of the resulting array.UInt64
Arguments
max_size— Maximum size of the resulting array.UInt64x— Argument (column name or expression).Any
Returned value
Returns an array of the last argument values. Array(T)
Examples
Usage example
Comparison with groupArray