TOPN_ARRAY
Overview
Returns the top N most frequently occurring values as an ARRAY, containing only the values themselves (no counts), ordered by frequency in descending order.
Syntax
Parameters
<expr>: The column or expression to analyze. Note: only string-compatible types (STRING/VARCHAR) are supported; numeric types are not.<n>: INT type, the number of top values to return.
Examples
Related Documentation
- TOPN — returns both values and their occurrence counts
- APPROX_TOP_K — approximate top K, suitable for large datasets
