@@ -588,6 +588,29 @@ INSERT INTO tb_name VALUES (TODAY(), ...);
Aggregate functions return single result row for each group in the query result set. Groups are determined by `GROUP BY` clause or time window clause if they are used; or the whole result is considered a group if neither of them is used.
### APERCENTILE
```
SELECT APERCENTILE(field_name, P[, algo_type])
FROM { tb_name | stb_name } [WHERE clause]
```
**Description**: Similar to `PERCENTILE`, but a approximated result is returned.
**Return value type**: DOUBLE.
**Applicable column types**: Numeric types.
**Applicable table types**: table, STable.
**More explanations**
- _P_ is in range [0,100], when _P_ is 0, the result is same as using function MIN; when _P_ is 100, the result is same as function MAX.
-**algo_type** can only be input as `default` or `t-digest`, if it's not specified `default` will be used, i.e. `apercentile(column_name, 50)` is same as `apercentile(column_name, 50, "default")`.
- If `default` is used, histogram based algorithm is used for calculation. If `t-digest` is used, `t-digest` sampling algorithm is used to calculate the result.
**Nested query**: It can be used in both the outer query and inner query in a nested query.
SELECT MODE(field_name) FROM tb_name [WHERE clause];
```
**Description**:The value which has the highest frequency of occurrence. NULL is returned if there are multiple values which have highest frequency of occurrence.
**Return value type**:Same as the data type of the column being operated upon.
**Applicable column types**: All data types.
**More explanations**:Considering the number of returned result set is unpredictable, it's suggested to limit the number of unique values to 100,000, otherwise error will be returned.
### SPREAD
```
...
...
@@ -770,32 +778,25 @@ SELECT HISTOGRAM(field_name,bin_type, bin_description, normalized) FROM tb_nam
3. normalized: setting to 1/0 to turn on/off result normalization.
## Selector Functions
Selector functiosn choose one or more rows in the query result according to the semantics. You can specify to output primary timestamp column and other columns including tbname and tags so that you can easily know which rows the selected values belong to.
### APERCENTILE
### PERCENTILE
```
SELECT APERCENTILE(field_name, P[, algo_type])
FROM { tb_name | stb_name } [WHERE clause]
SELECT PERCENTILE(field_name, P) FROM { tb_name } [WHERE clause];
```
**Description**: Similar to `PERCENTILE`, but a approximated result is returned.
**Description**: The value whose rank in a specific column matches the specified percentage. If such a value matching the specified percentage doesn't exist in the column, an interpolation value will be returned.
**Return value type**: DOUBLE.
**Applicable column types**: Numeric types.
**Applicable table types**: table, STable.
**Applicable table types**: table.
**More explanations**
**More explanations**: _P_ is in range [0,100], when _P_ is 0, the result is same as using function MIN; when _P_ is 100, the result is same as function MAX.
- _P_ is in range [0,100], when _P_ is 0, the result is same as using function MIN; when _P_ is 100, the result is same as function MAX.
-**algo_type** can only be input as `default` or `t-digest`, if it's not specified `default` will be used, i.e. `apercentile(column_name, 50)` is same as `apercentile(column_name, 50, "default")`.
- If `default` is used, histogram based algorithm is used for calculation. If `t-digest` is used, `t-digest` sampling algorithm is used to calculate the result.
## Selector Functions
**Nested query**: It can be used in both the outer query and inner query in a nested query.
Selector functiosn choose one or more rows in the query result according to the semantics. You can specify to output primary timestamp column and other columns including tbname and tags so that you can easily know which rows the selected values belong to.
SELECT PERCENTILE(field_name, P) FROM { tb_name } [WHERE clause];
SELECT MODE(field_name) FROM tb_name [WHERE clause];
```
**Description**: The value whose rank in a specific column matches the specified percentage. If such a value matching the specified percentage doesn't exist in the column, an interpolation value will be returned.
**Description**:The value which has the highest frequency of occurrence. NULL is returned if there are multiple values which have highest frequency of occurrence.
**Return value type**: DOUBLE.
**Return value type**:Same as the data type of the column being operated upon.
**Applicable column types**: Numeric types.
**Applicable column types**: All data types.
**Applicable table types**: table.
**More explanations**:Considering the number of returned result set is unpredictable, it's suggested to limit the number of unique values to 100,000, otherwise error will be returned.
**More explanations**: _P_ is in range [0,100], when _P_ is 0, the result is same as using function MIN; when _P_ is 100, the result is same as function MAX.