Skip to main content

groupArraySample

Introduced in: v20.3.0 Creates an array of sample argument values. The size of the resulting array is limited to max_size elements. Argument values are selected and added to the array randomly. Syntax
Parameters
  • max_size — Maximum size of the resulting array. UInt64
  • seed — Optional. Seed for the random number generator. When omitted, every aggregation state seeds itself from a thread-local generator, so the sample is different for every evaluation and the function is non-deterministic. Pass a seed for a reproducible sample. UInt64
  • x — Argument (column name or expression). Any
Arguments
  • array_column — Column containing arrays to be aggregated. Array
Returned value Array of randomly selected x arguments. Array(T) Examples Usage example
Query
Response
Example using a seed
Query
Response
Using an expression as an argument
Query
Response
Last modified on September 19, 2026