APPROX_PERCENTILE_COMBINE
functionsupportedCore SQL functionsCombines (merges) percentile input states into a single output state. This allows scenarios where APPROX_PERCENTILE_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_PERCENTILE_COMBINE, producing the same output state as a single run of APPROX_PERCENTILE_ACCUMULATE over the entire table.
Syntax
APPROX_PERCENTILE_COMBINE( <state> )
Parameters
| Name | Required | Description |
|---|---|---|
state | required | An expression that contains state information generated by a call to APPROX_PERCENTILE_ACCUMULATE. |
Usage notes
- Decimal-float (DECFLOAT) values aren’t supported.
Example
Return an approximation for the median of numbers in the testtable.c2 column (0.5 means the 50th percentile): Return an approximate value for the 2nd percentile of numbers in mytest.s1 union mytest2.s2. For a more extensive example, see the Examples section in APPROX_PERCENTILE_ACCUMULATE.