Skip to main content

groupArrayLast

Introduced in: v23.1.0 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. UInt64
  • x — Argument (column name or expression). Any
Returned value Returns an array of the last argument values. Array(T) Examples Usage example
Query
Response
Comparison with groupArray
Query
Response
Last modified on June 19, 2026