docs: add histogram function

This commit is contained in:
gccgdb1234 2022-05-31 09:01:02 +08:00
parent e9216e929e
commit 2a8e87a777
2 changed files with 35 additions and 33 deletions

View File

@ -294,7 +294,7 @@ SELECT HISTOGRAM(field_namebin_type, bin_description, normalized) FROM tb_nam
**示例**
```sql
```mysql
taos> SELECT HISTOGRAM(voltage, "user_input", "[1,3,5,7]", 1) FROM meters;
histogram(voltage, "user_input", "[1,3,5,7]", 1) |
=======================================================

View File

@ -275,11 +275,12 @@ SELECT HISTOGRAM(field_namebin_type, bin_description, normalized) FROM tb_nam
**Applicable table types**: table, STable
**说明**
**Explanations**
1. bin_type: parameter to indicate the bucket type, valid inputs are: "user_input", "linear_bin", "log_bin"。
2. bin_description: parameter to describe how to generate bucketscan be in the following JSON formats for each bin_type respectively:
- "user_input": "[1, 3, 5, 7]"
User defined specified bin values.
- "user_input": "[1, 3, 5, 7]": User specified bin values.
- "linear_bin": "{"start": 0.0, "width": 5.0, "count": 5, "infinity": true}"
"start" - bin starting point.
@ -294,11 +295,12 @@ SELECT HISTOGRAM(field_namebin_type, bin_description, normalized) FROM tb_nam
"count" - number of bins generated.
"infinity" - whether to add-inf, infas start/end point in generated range of bins.
The above "log_bin" descriptor generates a set of bins:[-inf, 1.0, 2.0, 4.0, 8.0, 16.0, +inf].
3. normalized: setting to 1/0 to turn on/off result normalization.
**示例**
**Example**
```sql
```mysql
taos> SELECT HISTOGRAM(voltage, "user_input", "[1,3,5,7]", 1) FROM meters;
histogram(voltage, "user_input", "[1,3,5,7]", 1) |
=======================================================