This topic describes the syntax of approximate functions and provides examples on how to use these functions.

The following table describes the supported approximate functions.

Function Description Example
`approx_distinct(x)` Returns the approximate number of unique input values. N/A
`approx_percentile(x,percentage)` Sorts the input values and returns the approximate value at the specified percentage position. Return the approximate value at the 50 percentage position: `approx_percentile(x,0.5)`.
`approx_percentile(x, percentages)` Similar to the preceding function. However, you can specify multiple percentages to return the approximate values at the specified percentages. `approx_percentile(x,array[0.1,0.2])`
`numeric_histogram(buckets, Value)` Analyzes numeric values by bucket. Values of the Value column are divided into buckets for analysis. The number of buckets is determined by buckets.

This function returns the keys of the buckets and the count of the values in each bucket. This works similarly to the `select count group by` statement for numbers.

Note The returned result is in JSON format.
Divide the latency of POST requests into 10 buckets and view the size of each bucket: `method:POST | select numeric_histogram(10,latency)`.
`numeric_histogram_u(buckets, Value)` Analyzes numeric values by bucket. Values of the Value column are divided into buckets for analysis. The number of buckets is determined by buckets.

This function returns the keys of the buckets and the count of the values in each bucket. This works similarly to the `select count group by` statement for numbers.

Note The returned result is in the format of multiple rows and columns.
Divide the latency of POST requests into 10 buckets and view the size of each bucket: `method:POST | select numeric_histogram(10,latency)`.
Note Buckets described in the preceding functions are evenly divided by aggregation degree. The returned result for each bucket includes the average value of the bucket and the number of values in the bucket.