APPROX_TOP_K_COMBINE
functionsupportedCore SQL functionsCombines (merges) input states into a single output state. This allows scenarios where APPROX_TOP_K_ACCUMULATE is run over horizontal partitions of the same table, producing an algorithm state for each table partition. These states can later be combined using APPROX_TOP_K_COMBINE, producing the same output state as a single run of APPROX_TOP_K_ACCUMULATE over the entire table.
Syntax
supportedpartialnot supportednot scored
APPROX_TOP_K_COMBINE( <state> [ , <counters> ] )
Parameters
| Name | Required | Description |
|---|---|---|
state | required | An expression that contains state information generated by a call to APPROX_TOP_K_ACCUMULATE. |
counters | required | This is the maximum number of distinct values that can be tracked at a time during the estimation process. For example, if counters is set to 100000, then the algorithm tracks 100,000 distinct values, attempting to keep the 100,000 most frequent values. The maximum number of counters is 100000 (100,000). |
Returns
This returns information about the “state” of the top K calculation. This state information is not usually useful by itself, but can be passed to the function APPROX_TOP_K_ESTIMATE.
Usage notes
- If counters is defined, the output state uses the specified number of counters.
- If counters is not defined, all input states must have the same number of counters.
- Decimal-float (DECFLOAT) values aren’t supported.