You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hu...@apache.org on 2022/11/25 14:37:02 UTC

[iotdb] branch master updated: Update user guide (query part/en) (#8168)

This is an automated email from the ASF dual-hosted git repository.

hui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 4cd5a5d5d6 Update user guide (query part/en) (#8168)
4cd5a5d5d6 is described below

commit 4cd5a5d5d6656ae909c1f297152cb70c871bd23c
Author: liuminghui233 <36...@users.noreply.github.com>
AuthorDate: Fri Nov 25 22:36:57 2022 +0800

    Update user guide (query part/en) (#8168)
---
 docs/UserGuide/Monitor-Alert/Alerting.md           |    2 +-
 docs/UserGuide/Operators-Functions/Aggregation.md  |   58 ++
 .../Anomaly-Detection.md                           |    0
 docs/UserGuide/Operators-Functions/Comparison.md   |  305 ++++++
 docs/UserGuide/Operators-Functions/Constant.md     |   57 ++
 .../Operators-Functions/Continuous-Interval.md     |   73 ++
 docs/UserGuide/Operators-Functions/Conversion.md   |  127 +++
 .../Data-Matching.md                               |    0
 .../Data-Profiling.md                              |    0
 .../Data-Quality.md                                |    0
 .../Data-Repairing.md                              |    0
 .../Frequency-Domain.md                            |    0
 docs/UserGuide/Operators-Functions/Lambda.md       |   77 ++
 docs/UserGuide/Operators-Functions/Logical.md      |   63 ++
 docs/UserGuide/Operators-Functions/Mathematical.md |  113 +++
 .../Overview.md}                                   |   24 +
 docs/UserGuide/Operators-Functions/Sample.md       |  389 +++++++
 docs/UserGuide/Operators-Functions/Selection.md    |   51 +
 .../Series-Discovery.md                            |    0
 .../String.md}                                     |   66 ++
 .../Time-Series.md}                                |    2 +-
 .../User-Defined-Function.md}                      |    2 -
 .../Operators-Functions/Variation-Trend.md         |   54 +
 .../Query-Data/{Result-Format.md => Align-By.md}   |    2 +-
 .../Continuous-Query.md                            |    0
 .../Query-Data/{Fill-Null-Value.md => Fill.md}     |    0
 .../Query-Data/{Aggregate-Query.md => Group-By.md} |  142 +--
 docs/UserGuide/Query-Data/Having-Condition.md      |  115 +++
 .../{UDF-Library/M4.md => Query-Data/Order-By.md}  |    7 +-
 docs/UserGuide/Query-Data/Overview.md              |   76 +-
 docs/UserGuide/Query-Data/Pagination.md            |    2 +-
 .../Query-Data/Performance-Tracing-Tool.md         |   53 -
 docs/UserGuide/Query-Data/Select-Expression.md     | 1068 +-------------------
 .../{Process-Data => Query-Data}/Select-Into.md    |    0
 .../{Query-Filter.md => Where-Condition.md}        |    0
 docs/zh/UserGuide/Query-Data/Align-By.md           |    2 +-
 site/src/main/.vuepress/config.js                  |   72 +-
 37 files changed, 1729 insertions(+), 1273 deletions(-)

diff --git a/docs/UserGuide/Monitor-Alert/Alerting.md b/docs/UserGuide/Monitor-Alert/Alerting.md
index 1f97bc6697..e94b3f35a2 100644
--- a/docs/UserGuide/Monitor-Alert/Alerting.md
+++ b/docs/UserGuide/Monitor-Alert/Alerting.md
@@ -39,7 +39,7 @@ The data sink then forwards the alert to the external terminal.
     * It is Suitable for scenarios where the original data needs to be down-sampled and persisted.
     * Since the timing query hardly affects the writing of the original time series, it is suitable for scenarios that are sensitive to the performance of the original data writing performance.
 
-With the introduction of the  [Trigger](../Process-Data/Triggers.md) into IoTDB,
+With the introduction of the  [Trigger](../Triggers/Triggers.md) into IoTDB,
 at present, users can use these two modules with `AlertManager` to realize the writing triggered alerting mode.
 
 
diff --git a/docs/UserGuide/Operators-Functions/Aggregation.md b/docs/UserGuide/Operators-Functions/Aggregation.md
new file mode 100644
index 0000000000..ca9e03d461
--- /dev/null
+++ b/docs/UserGuide/Operators-Functions/Aggregation.md
@@ -0,0 +1,58 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+        http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+# Aggregate Functions
+
+Aggregate functions are many-to-one functions. They perform aggregate calculations on a set of values, resulting in a single aggregated result.
+
+All aggregate functions except `COUNT()` ignore null values and return null when there are no input rows or all values are null. For example, `SUM()` returns null instead of zero, and `AVG()` does not include null values in the count.
+
+The aggregate functions supported by IoTDB are as follows:
+
+| Function Name | Function Description                                         | Allowed Input Data Types | Output Data Types                   |
+| ------------- | ------------------------------------------------------------ | ------------------------ | ----------------------------------- |
+| SUM           | Summation.                                                   | INT32 INT64 FLOAT DOUBLE | DOUBLE                              |
+| COUNT         | Counts the number of data points.                            | All types                | INT                                 |
+| AVG           | Average.                                                     | INT32 INT64 FLOAT DOUBLE | DOUBLE                              |
+| EXTREME       | Finds the value with the largest absolute value. Returns a positive value if the maximum absolute value of positive and negative values is equal. | INT32 INT64 FLOAT DOUBLE | Consistent with the input data type |
+| MAX_VALUE     | Find the maximum value.                                      | INT32 INT64 FLOAT DOUBLE | Consistent with the input data type |
+| MIN_VALUE     | Find the minimum value.                                      | INT32 INT64 FLOAT DOUBLE | Consistent with the input data type |
+| FIRST_VALUE   | Find the value with the smallest timestamp.                  | All data types           | Consistent with input data type     |
+| LAST_VALUE    | Find the value with the largest timestamp.                   | All data types           | Consistent with input data type     |
+| MAX_TIME      | Find the maximum timestamp.                                  | All data Types           | Timestamp                           |
+| MIN_TIME      | Find the minimum timestamp.                                  | All data Types           | Timestamp                           |
+
+**Example:** Count Points
+
+```sql
+select count(status) from root.ln.wf01.wt01;
+```
+Result:
+
+```
++-------------------------------+
+|count(root.ln.wf01.wt01.status)|
++-------------------------------+
+|                          10080|
++-------------------------------+
+Total line number = 1
+It costs 0.016s
+```
\ No newline at end of file
diff --git a/docs/UserGuide/UDF-Library/Anomaly-Detection.md b/docs/UserGuide/Operators-Functions/Anomaly-Detection.md
similarity index 100%
rename from docs/UserGuide/UDF-Library/Anomaly-Detection.md
rename to docs/UserGuide/Operators-Functions/Anomaly-Detection.md
diff --git a/docs/UserGuide/Operators-Functions/Comparison.md b/docs/UserGuide/Operators-Functions/Comparison.md
new file mode 100644
index 0000000000..1581188d7b
--- /dev/null
+++ b/docs/UserGuide/Operators-Functions/Comparison.md
@@ -0,0 +1,305 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+        http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+# Comparison Operators and Functions
+
+## Basic comparison operators
+
+Supported operators `>`, `>=`, `<`, `<=`, `==`, `!=` (or  `<>` )
+
+Supported input data types: `INT32`, `INT64`, `FLOAT` and `DOUBLE` 
+
+Note: It will transform all type to `DOUBLE` then do computation. 
+
+Output data type: `BOOLEAN`
+
+**Example:**
+
+```sql
+select a, b, a > 10, a <= b, !(a <= b), a > 10 && a > b from root.test;
+```
+
+```
+IoTDB> select a, b, a > 10, a <= b, !(a <= b), a > 10 && a > b from root.test;
++-----------------------------+-----------+-----------+----------------+--------------------------+---------------------------+------------------------------------------------+
+|                         Time|root.test.a|root.test.b|root.test.a > 10|root.test.a <= root.test.b|!root.test.a <= root.test.b|(root.test.a > 10) & (root.test.a > root.test.b)|
++-----------------------------+-----------+-----------+----------------+--------------------------+---------------------------+------------------------------------------------+
+|1970-01-01T08:00:00.001+08:00|         23|       10.0|            true|                     false|                       true|                                            true|
+|1970-01-01T08:00:00.002+08:00|         33|       21.0|            true|                     false|                       true|                                            true|
+|1970-01-01T08:00:00.004+08:00|         13|       15.0|            true|                      true|                      false|                                           false|
+|1970-01-01T08:00:00.005+08:00|         26|        0.0|            true|                     false|                       true|                                            true|
+|1970-01-01T08:00:00.008+08:00|          1|       22.0|           false|                      true|                      false|                                           false|
+|1970-01-01T08:00:00.010+08:00|         23|       12.0|            true|                     false|                       true|                                            true|
++-----------------------------+-----------+-----------+----------------+--------------------------+---------------------------+------------------------------------------------+
+```
+
+## `BETWEEN ... AND ...` operator
+
+|operator |meaning|
+|-----------------------------|-----------|
+|`BETWEEN ... AND ...` |within the specified range|
+|`NOT BETWEEN ... AND ...` |Not within the specified range|
+
+**Example:** Select data within or outside the interval [36.5,40]:
+
+```sql
+select temperature from root.sg1.d1 where temperature between 36.5 and 40;
+```
+
+```sql
+select temperature from root.sg1.d1 where temperature not between 36.5 and 40;
+```
+
+## Fuzzy matching operator
+
+For TEXT type data, support fuzzy matching of data using `Like` and `Regexp` operators.
+
+|operator |meaning|
+|-----------------------------|-----------|
+|`LIKE` | matches simple patterns|
+|`NOT LIKE` |cannot match simple pattern|
+|`REGEXP` | Match regular expression|
+|`NOT REGEXP` |Cannot match regular expression|
+
+Input data type: `TEXT`
+
+Return type: `BOOLEAN`
+
+### Use `Like` for fuzzy matching
+
+**Matching rules:**
+
+- `%` means any 0 or more characters.
+- `_` means any single character.
+
+**Example 1:** Query the data under `root.sg.d1` that contains `'cc'` in `value`.
+
+```shell
+IoTDB> select * from root.sg.d1 where value like '%cc%'
++--------------------------+----------------+
+| Time|root.sg.d1.value|
++--------------------------+----------------+
+|2017-11-01T00:00:00.000+08:00| aabbccdd|
+|2017-11-01T00:00:01.000+08:00| cc|
++--------------------------+----------------+
+Total line number = 2
+It costs 0.002s
+```
+
+**Example 2:** Query the data under `root.sg.d1` with `'b'` in the middle of `value` and any single character before and after.
+
+```shell
+IoTDB> select * from root.sg.device where value like '_b_'
++--------------------------+----------------+
+| Time|root.sg.d1.value|
++--------------------------+----------------+
+|2017-11-01T00:00:02.000+08:00|abc|
++--------------------------+----------------+
+Total line number = 1
+It costs 0.002s
+```
+
+### Use `Regexp` for fuzzy matching
+
+The filter condition that needs to be passed in is **Java standard library style regular expression**.
+
+**Common regular matching examples:**
+
+```
+All characters with a length of 3-20: ^.{3,20}$
+Uppercase English characters: ^[A-Z]+$
+Numbers and English characters: ^[A-Za-z0-9]+$
+Starting with a: ^a.*
+```
+
+**Example 1:** Query the string of 26 English characters for value under root.sg.d1.
+
+```shell
+IoTDB> select * from root.sg.d1 where value regexp '^[A-Za-z]+$'
++--------------------------+----------------+
+| Time|root.sg.d1.value|
++--------------------------+----------------+
+|2017-11-01T00:00:00.000+08:00| aabbccdd|
+|2017-11-01T00:00:01.000+08:00| cc|
++--------------------------+----------------+
+Total line number = 2
+It costs 0.002s
+```
+
+**Example 2:** Query root.sg.d1 where the value is a string consisting of 26 lowercase English characters and the time is greater than 100.
+
+```shell
+IoTDB> select * from root.sg.d1 where value regexp '^[a-z]+$' and time > 100
++--------------------------+----------------+
+| Time|root.sg.d1.value|
++--------------------------+----------------+
+|2017-11-01T00:00:00.000+08:00| aabbccdd|
+|2017-11-01T00:00:01.000+08:00| cc|
++--------------------------+----------------+
+Total line number = 2
+It costs 0.002s
+```
+
+**Example 3:**
+
+```sql
+select b, b like '1%', b regexp '[0-2]' from root.test;
+```
+
+operation result
+```
++-----------------------------+-----------+------- ------------------+--------------------------+
+| Time|root.test.b|root.test.b LIKE '^1.*?$'|root.test.b REGEXP '[0-2]'|
++-----------------------------+-----------+------- ------------------+--------------------------+
+|1970-01-01T08:00:00.001+08:00| 111test111| true| true|
+|1970-01-01T08:00:00.003+08:00| 333test333| false| false|
++-----------------------------+-----------+------- ------------------+--------------------------+
+```
+
+## `IS NULL` operator
+
+|operator |meaning|
+|-----------------------------|-----------|
+|`IS NULL` |is a null value|
+|`IS NOT NULL` |is not a null value|
+
+**Example 1:** Select data with empty values:
+
+```sql
+select code from root.sg1.d1 where temperature is null;
+```
+
+**Example 2:** Select data with non-null values:
+
+```sql
+select code from root.sg1.d1 where temperature is not null;
+```
+
+## `IN` operator
+
+|operator |meaning|
+|-----------------------------|-----------|
+|`IN` / `CONTAINS` | are the values ​​in the specified list|
+|`NOT IN` / `NOT CONTAINS` |not a value in the specified list|
+
+Input data type: `All Types`
+
+return type `BOOLEAN`
+
+**Note: Please ensure that the values ​​in the collection can be converted to the type of the input data. **
+> 
+> For example:
+>
+> `s1 in (1, 2, 3, 'test')`, the data type of `s1` is `INT32`
+>
+> We will throw an exception because `'test'` cannot be converted to type `INT32`
+> 
+**Example 1:** Select data with values ​​within a certain range:
+
+```sql
+select code from root.sg1.d1 where code in ('200', '300', '400', '500');
+```
+
+**Example 2:** Select data with values ​​outside a certain range:
+
+```sql
+select code from root.sg1.d1 where code not in ('200', '300', '400', '500');
+```
+
+**Example 3:**
+
+```sql
+select a, a in (1, 2) from root.test;
+```
+
+Output 2:
+```
++-----------------------------+-----------+------- -------------+
+| Time|root.test.a|root.test.a IN (1,2)|
++-----------------------------+-----------+------- -------------+
+|1970-01-01T08:00:00.001+08:00| 1| true|
+|1970-01-01T08:00:00.003+08:00| 3| false|
++-----------------------------+-----------+------- -------------+
+```
+
+## Condition Functions
+
+Condition functions are used to check whether timeseries data points satisfy some specific condition. 
+
+They return BOOLEANs.
+
+Currently, IoTDB supports the following condition functions:
+
+| Function Name | Allowed Input Series Data Types | Required Attributes                           | Output Series Data Type | Series Data Type  Description                 |
+|---------------|---------------------------------|-----------------------------------------------|-------------------------|-----------------------------------------------|
+| ON_OFF        | INT32 / INT64 / FLOAT / DOUBLE  | `threshold`: a double type variate            | BOOLEAN                 | Return `ts_value >= threshold`.               |
+| IN_RANGR      | INT32 / INT64 / FLOAT / DOUBLE  | `lower`: DOUBLE type<br/>`upper`: DOUBLE type | BOOLEAN                 | Return `ts_value >= lower && value <= upper`. |
+
+Example Data:
+```
+IoTDB> select ts from root.test;
++-----------------------------+------------+
+|                         Time|root.test.ts|
++-----------------------------+------------+
+|1970-01-01T08:00:00.001+08:00|           1|
+|1970-01-01T08:00:00.002+08:00|           2|
+|1970-01-01T08:00:00.003+08:00|           3|
+|1970-01-01T08:00:00.004+08:00|           4|
++-----------------------------+------------+
+```
+
+##### Test 1
+SQL:
+```sql
+select ts, on_off(ts, 'threshold'='2') from root.test;
+```
+
+Output:
+```
+IoTDB> select ts, on_off(ts, 'threshold'='2') from root.test;
++-----------------------------+------------+-------------------------------------+
+|                         Time|root.test.ts|on_off(root.test.ts, "threshold"="2")|
++-----------------------------+------------+-------------------------------------+
+|1970-01-01T08:00:00.001+08:00|           1|                                false|
+|1970-01-01T08:00:00.002+08:00|           2|                                 true|
+|1970-01-01T08:00:00.003+08:00|           3|                                 true|
+|1970-01-01T08:00:00.004+08:00|           4|                                 true|
++-----------------------------+------------+-------------------------------------+
+```
+
+##### Test 2
+Sql:
+```sql
+select ts, in_range(ts, 'lower'='2', 'upper'='3.1') from root.test;
+```
+
+Output:
+```
+IoTDB> select ts, in_range(ts,'lower'='2', 'upper'='3.1') from root.test;
++-----------------------------+------------+--------------------------------------------------+
+|                         Time|root.test.ts|in_range(root.test.ts, "lower"="2", "upper"="3.1")|
++-----------------------------+------------+--------------------------------------------------+
+|1970-01-01T08:00:00.001+08:00|           1|                                             false|
+|1970-01-01T08:00:00.002+08:00|           2|                                              true|
+|1970-01-01T08:00:00.003+08:00|           3|                                              true|
+|1970-01-01T08:00:00.004+08:00|           4|                                             false|
++-----------------------------+------------+--------------------------------------------------+
+```
\ No newline at end of file
diff --git a/docs/UserGuide/Operators-Functions/Constant.md b/docs/UserGuide/Operators-Functions/Constant.md
new file mode 100644
index 0000000000..0cec3713d7
--- /dev/null
+++ b/docs/UserGuide/Operators-Functions/Constant.md
@@ -0,0 +1,57 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+        http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+# Constant Timeseries Generating Functions
+
+The constant timeseries generating function is used to generate a timeseries in which the values of all data points are the same.
+
+The constant timeseries generating function accepts one or more timeseries inputs, and the timestamp set of the output data points is the union of the timestamp sets of the input timeseries.
+
+Currently, IoTDB supports the following constant timeseries generating functions:
+
+| Function Name | Required Attributes                                          | Output Series Data Type                      | Description                                                  |
+| ------------- | ------------------------------------------------------------ | -------------------------------------------- | ------------------------------------------------------------ |
+| CONST         | `value`: the value of the output data point <br />`type`: the type of the output data point, it can only be INT32 / INT64 / FLOAT / DOUBLE / BOOLEAN / TEXT | Determined by the required attribute  `type` | Output the user-specified constant timeseries according to the  attributes `value` and `type`. |
+| PI            | None                                                         | DOUBLE                                       | Data point value: a `double` value of  `π`, the ratio of the circumference of a circle to its diameter, which is equals to `Math.PI` in the *Java Standard Library*. |
+| E             | None                                                         | DOUBLE                                       | Data point value: a `double` value of  `e`, the base of the natural logarithms, which is equals to `Math.E` in the *Java Standard Library*. |
+
+Example:
+
+```   sql
+select s1, s2, const(s1, 'value'='1024', 'type'='INT64'), pi(s2), e(s1, s2) from root.sg1.d1; 
+```
+
+Result:
+
+```
+select s1, s2, const(s1, 'value'='1024', 'type'='INT64'), pi(s2), e(s1, s2) from root.sg1.d1; 
++-----------------------------+--------------+--------------+-----------------------------------------------------+------------------+---------------------------------+
+|                         Time|root.sg1.d1.s1|root.sg1.d1.s2|const(root.sg1.d1.s1, "value"="1024", "type"="INT64")|pi(root.sg1.d1.s2)|e(root.sg1.d1.s1, root.sg1.d1.s2)|
++-----------------------------+--------------+--------------+-----------------------------------------------------+------------------+---------------------------------+
+|1970-01-01T08:00:00.000+08:00|           0.0|           0.0|                                                 1024| 3.141592653589793|                2.718281828459045|
+|1970-01-01T08:00:00.001+08:00|           1.0|          null|                                                 1024|              null|                2.718281828459045|
+|1970-01-01T08:00:00.002+08:00|           2.0|          null|                                                 1024|              null|                2.718281828459045|
+|1970-01-01T08:00:00.003+08:00|          null|           3.0|                                                 null| 3.141592653589793|                2.718281828459045|
+|1970-01-01T08:00:00.004+08:00|          null|           4.0|                                                 null| 3.141592653589793|                2.718281828459045|
++-----------------------------+--------------+--------------+-----------------------------------------------------+------------------+---------------------------------+
+Total line number = 5
+It costs 0.005s
+```
\ No newline at end of file
diff --git a/docs/UserGuide/Operators-Functions/Continuous-Interval.md b/docs/UserGuide/Operators-Functions/Continuous-Interval.md
new file mode 100644
index 0000000000..b8d7d8ba5a
--- /dev/null
+++ b/docs/UserGuide/Operators-Functions/Continuous-Interval.md
@@ -0,0 +1,73 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+        http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+# Continuous Interval Functions
+
+The continuous interval functions are used to query all continuous intervals that meet specified conditions.
+They can be divided into two categories according to return value:
+1. Returns the start timestamp and time span of the continuous interval that meets the conditions (a time span of 0 means that only the start time point meets the conditions)
+2. Returns the start timestamp of the continuous interval that meets the condition and the number of points in the interval (a number of 1 means that only the start time point meets the conditions)
+
+| Function Name     | Input TSDatatype                     | Parameters                                                                                    | Output TSDatatype | Function Description                                                                                                                                                         |
+|-------------------|--------------------------------------|-----------------------------------------------------------------------------------------------|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| ZERO_DURATION     | INT32/ INT64/ FLOAT/ DOUBLE/ BOOLEAN | `min`:Optional with default value `0L`</br>`max`:Optional with default value `Long.MAX_VALUE` | Long              | Return intervals' start times and duration times in which the value is always 0(false), and the duration time `t` satisfy `t >= min && t <= max`. The unit of `t` is ms      |
+| NON_ZERO_DURATION | INT32/ INT64/ FLOAT/ DOUBLE/ BOOLEAN | `min`:Optional with default value `0L`</br>`max`:Optional with default value `Long.MAX_VALUE` | Long              | Return intervals' start times and duration times in which the value is always not 0, and the duration time `t` satisfy `t >= min && t <= max`. The unit of `t` is ms         |
+| ZERO_COUNT        | INT32/ INT64/ FLOAT/ DOUBLE/ BOOLEAN | `min`:Optional with default value `1L`</br>`max`:Optional with default value `Long.MAX_VALUE` | Long              | Return intervals' start times and the number of data points in the interval in which the value is always 0(false). Data points number `n` satisfy `n >= min && n <= max`     |
+| NON_ZERO_COUNT    | INT32/ INT64/ FLOAT/ DOUBLE/ BOOLEAN | `min`:Optional with default value `1L`</br>`max`:Optional with default value `Long.MAX_VALUE` | Long              | Return intervals' start times and the number of data points in the interval in which the value is always not 0(false). Data points number `n` satisfy `n >= min && n <= max` |
+
+##### Demonstrate
+Example data:
+```
+IoTDB> select s1,s2,s3,s4,s5 from root.sg.d2;
++-----------------------------+-------------+-------------+-------------+-------------+-------------+
+|                         Time|root.sg.d2.s1|root.sg.d2.s2|root.sg.d2.s3|root.sg.d2.s4|root.sg.d2.s5|
++-----------------------------+-------------+-------------+-------------+-------------+-------------+
+|1970-01-01T08:00:00.000+08:00|            0|            0|          0.0|          0.0|        false|
+|1970-01-01T08:00:00.001+08:00|            1|            1|          1.0|          1.0|         true|
+|1970-01-01T08:00:00.002+08:00|            1|            1|          1.0|          1.0|         true|
+|1970-01-01T08:00:00.003+08:00|            0|            0|          0.0|          0.0|        false|
+|1970-01-01T08:00:00.004+08:00|            1|            1|          1.0|          1.0|         true|
+|1970-01-01T08:00:00.005+08:00|            0|            0|          0.0|          0.0|        false|
+|1970-01-01T08:00:00.006+08:00|            0|            0|          0.0|          0.0|        false|
+|1970-01-01T08:00:00.007+08:00|            1|            1|          1.0|          1.0|         true|
++-----------------------------+-------------+-------------+-------------+-------------+-------------+
+```
+
+Sql:
+```sql
+select s1, zero_count(s1), non_zero_count(s2), zero_duration(s3), non_zero_duration(s4) from root.sg.d2;
+```
+
+Result:
+```
++-----------------------------+-------------+-------------------------+-----------------------------+----------------------------+--------------------------------+
+|                         Time|root.sg.d2.s1|zero_count(root.sg.d2.s1)|non_zero_count(root.sg.d2.s2)|zero_duration(root.sg.d2.s3)|non_zero_duration(root.sg.d2.s4)|
++-----------------------------+-------------+-------------------------+-----------------------------+----------------------------+--------------------------------+
+|1970-01-01T08:00:00.000+08:00|            0|                        1|                         null|                           0|                            null|
+|1970-01-01T08:00:00.001+08:00|            1|                     null|                            2|                        null|                               1|
+|1970-01-01T08:00:00.002+08:00|            1|                     null|                         null|                        null|                            null|
+|1970-01-01T08:00:00.003+08:00|            0|                        1|                         null|                           0|                            null|
+|1970-01-01T08:00:00.004+08:00|            1|                     null|                            1|                        null|                               0|
+|1970-01-01T08:00:00.005+08:00|            0|                        2|                         null|                           1|                            null|
+|1970-01-01T08:00:00.006+08:00|            0|                     null|                         null|                        null|                            null|
+|1970-01-01T08:00:00.007+08:00|            1|                     null|                            1|                        null|                               0|
++-----------------------------+-------------+-------------------------+-----------------------------+----------------------------+--------------------------------+
+```
\ No newline at end of file
diff --git a/docs/UserGuide/Operators-Functions/Conversion.md b/docs/UserGuide/Operators-Functions/Conversion.md
new file mode 100644
index 0000000000..e70dd634ce
--- /dev/null
+++ b/docs/UserGuide/Operators-Functions/Conversion.md
@@ -0,0 +1,127 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+        http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+# Data Type Conversion Function
+
+The IoTDB currently supports 6 data types, including INT32, INT64 ,FLOAT, DOUBLE, BOOLEAN, TEXT. When we query or evaluate data, we may need to convert data types, such as TEXT to INT32, or improve the accuracy of the data, such as FLOAT to DOUBLE. Therefore, IoTDB supports the use of cast functions to convert data types.
+
+| Function Name | Required Attributes                                          | Output Series Data Type                      | Series Data Type  Description                               |
+| ------------- | ------------------------------------------------------------ | -------------------------------------------- | ----------------------------------------------------------- |
+| CAST          | `type`: the type of the output data point, it can only be INT32 / INT64 / FLOAT / DOUBLE / BOOLEAN / TEXT | Determined by the required attribute  `type` | Converts data to the type specified by the `type` argument. |
+
+#### Notes
+1. The value of type BOOLEAN is `true`, when data is converted to BOOLEAN if INT32 and INT64 are not 0, FLOAT and DOUBLE are not 0.0, TEXT is not empty string or "false", otherwise `false`.    
+
+```
+IoTDB> show timeseries root.sg.d1.*;
++-------------+-----+-------------+--------+--------+-----------+----+----------+
+|   timeseries|alias|     database|dataType|encoding|compression|tags|attributes|
++-------------+-----+-------------+--------+--------+-----------+----+----------+
+|root.sg.d1.s3| null|      root.sg|   FLOAT|     RLE|     SNAPPY|null|      null|
+|root.sg.d1.s4| null|      root.sg|  DOUBLE|     RLE|     SNAPPY|null|      null|
+|root.sg.d1.s5| null|      root.sg|    TEXT|   PLAIN|     SNAPPY|null|      null|
+|root.sg.d1.s6| null|      root.sg| BOOLEAN|     RLE|     SNAPPY|null|      null|
+|root.sg.d1.s1| null|      root.sg|   INT32|     RLE|     SNAPPY|null|      null|
+|root.sg.d1.s2| null|      root.sg|   INT64|     RLE|     SNAPPY|null|      null|
++-------------+-----+-------------+--------+--------+-----------+----+----------+
+Total line number = 6
+It costs 0.006s
+IoTDB> select * from root.sg.d1;
++-----------------------------+-------------+-------------+-------------+-------------+-------------+-------------+
+|                         Time|root.sg.d1.s3|root.sg.d1.s4|root.sg.d1.s5|root.sg.d1.s6|root.sg.d1.s1|root.sg.d1.s2|
++-----------------------------+-------------+-------------+-------------+-------------+-------------+-------------+
+|1970-01-01T08:00:00.001+08:00|          1.1|          1.1|         test|        false|            1|            1|
+|1970-01-01T08:00:00.002+08:00|         -2.2|         -2.2|        false|         true|           -2|           -2|
+|1970-01-01T08:00:00.003+08:00|          0.0|          0.0|         true|         true|            0|            0|
++-----------------------------+-------------+-------------+-------------+-------------+-------------+-------------+
+Total line number = 3
+It costs 0.009s
+IoTDB> select cast(s1, 'type'='BOOLEAN'), cast(s2, 'type'='BOOLEAN'), cast(s3, 'type'='BOOLEAN'), cast(s4, 'type'='BOOLEAN'), cast(s5, 'type'='BOOLEAN') from root.sg.d1;
++-----------------------------+-------------------------------------+-------------------------------------+-------------------------------------+-------------------------------------+-------------------------------------+
+|                         Time|cast(root.sg.d1.s1, "type"="BOOLEAN")|cast(root.sg.d1.s2, "type"="BOOLEAN")|cast(root.sg.d1.s3, "type"="BOOLEAN")|cast(root.sg.d1.s4, "type"="BOOLEAN")|cast(root.sg.d1.s5, "type"="BOOLEAN")|
++-----------------------------+-------------------------------------+-------------------------------------+-------------------------------------+-------------------------------------+-------------------------------------+
+|1970-01-01T08:00:00.001+08:00|                                 true|                                 true|                                 true|                                 true|                                 true|
+|1970-01-01T08:00:00.002+08:00|                                 true|                                 true|                                 true|                                 true|                                false|
+|1970-01-01T08:00:00.003+08:00|                                false|                                false|                                false|                                false|                                 true|
++-----------------------------+-------------------------------------+-------------------------------------+-------------------------------------+-------------------------------------+-------------------------------------+
+Total line number = 3
+It costs 0.012s
+```
+
+2. The value of type INT32, INT64, FLOAT, DOUBLE are 1 or 1.0 and TEXT is "true", when BOOLEAN data is true, otherwise 0, 0.0 or "false".  
+
+```
+IoTDB> select cast(s6, 'type'='INT32'), cast(s6, 'type'='INT64'), cast(s6, 'type'='FLOAT'), cast(s6, 'type'='DOUBLE'), cast(s6, 'type'='TEXT') from root.sg.d1;
++-----------------------------+-----------------------------------+-----------------------------------+-----------------------------------+------------------------------------+----------------------------------+
+|                         Time|cast(root.sg.d1.s6, "type"="INT32")|cast(root.sg.d1.s6, "type"="INT64")|cast(root.sg.d1.s6, "type"="FLOAT")|cast(root.sg.d1.s6, "type"="DOUBLE")|cast(root.sg.d1.s6, "type"="TEXT")|
++-----------------------------+-----------------------------------+-----------------------------------+-----------------------------------+------------------------------------+----------------------------------+
+|1970-01-01T08:00:00.001+08:00|                                  0|                                  0|                                0.0|                                 0.0|                             false|
+|1970-01-01T08:00:00.002+08:00|                                  1|                                  1|                                1.0|                                 1.0|                              true|
+|1970-01-01T08:00:00.003+08:00|                                  1|                                  1|                                1.0|                                 1.0|                              true|
++-----------------------------+-----------------------------------+-----------------------------------+-----------------------------------+------------------------------------+----------------------------------+
+Total line number = 3
+It costs 0.016s
+```
+
+3. When TEXT is converted to INT32, INT64, or FLOAT, the TEXT is first converted to DOUBLE and then to the corresponding type, which may cause loss of precision. It will skip directly if the data can not be converted.
+
+```
+IoTDB> select cast(s5, 'type'='INT32'), cast(s5, 'type'='INT64'), cast(s5, 'type'='FLOAT') from root.sg.d1;
++----+-----------------------------------+-----------------------------------+-----------------------------------+
+|Time|cast(root.sg.d1.s5, "type"="INT32")|cast(root.sg.d1.s5, "type"="INT64")|cast(root.sg.d1.s5, "type"="FLOAT")|
++----+-----------------------------------+-----------------------------------+-----------------------------------+
++----+-----------------------------------+-----------------------------------+-----------------------------------+
+Empty set.
+It costs 0.005s
+```
+
+
+
+#### Syntax
+Example data:
+```
+IoTDB> select text from root.test;
++-----------------------------+--------------+
+|                         Time|root.test.text|
++-----------------------------+--------------+
+|1970-01-01T08:00:00.001+08:00|           1.1|
+|1970-01-01T08:00:00.002+08:00|             1|
+|1970-01-01T08:00:00.003+08:00|   hello world|
+|1970-01-01T08:00:00.004+08:00|         false|
++-----------------------------+--------------+
+```
+SQL:
+```sql
+select cast(text, 'type'='BOOLEAN'), cast(text, 'type'='INT32'), cast(text, 'type'='INT64'), cast(text, 'type'='FLOAT'), cast(text, 'type'='DOUBLE') from root.test;
+```
+Result:
+```
++-----------------------------+--------------------------------------+------------------------------------+------------------------------------+------------------------------------+-------------------------------------+
+|                         Time|cast(root.test.text, "type"="BOOLEAN")|cast(root.test.text, "type"="INT32")|cast(root.test.text, "type"="INT64")|cast(root.test.text, "type"="FLOAT")|cast(root.test.text, "type"="DOUBLE")|
++-----------------------------+--------------------------------------+------------------------------------+------------------------------------+------------------------------------+-------------------------------------+
+|1970-01-01T08:00:00.001+08:00|                                  true|                                   1|                                   1|                                 1.1|                                  1.1|
+|1970-01-01T08:00:00.002+08:00|                                  true|                                   1|                                   1|                                 1.0|                                  1.0|
+|1970-01-01T08:00:00.003+08:00|                                  true|                                null|                                null|                                null|                                 null|
+|1970-01-01T08:00:00.004+08:00|                                 false|                                null|                                null|                                null|                                 null|
++-----------------------------+--------------------------------------+------------------------------------+------------------------------------+------------------------------------+-------------------------------------+
+Total line number = 4
+It costs 0.078s
+```
diff --git a/docs/UserGuide/UDF-Library/Data-Matching.md b/docs/UserGuide/Operators-Functions/Data-Matching.md
similarity index 100%
rename from docs/UserGuide/UDF-Library/Data-Matching.md
rename to docs/UserGuide/Operators-Functions/Data-Matching.md
diff --git a/docs/UserGuide/UDF-Library/Data-Profiling.md b/docs/UserGuide/Operators-Functions/Data-Profiling.md
similarity index 100%
rename from docs/UserGuide/UDF-Library/Data-Profiling.md
rename to docs/UserGuide/Operators-Functions/Data-Profiling.md
diff --git a/docs/UserGuide/UDF-Library/Data-Quality.md b/docs/UserGuide/Operators-Functions/Data-Quality.md
similarity index 100%
rename from docs/UserGuide/UDF-Library/Data-Quality.md
rename to docs/UserGuide/Operators-Functions/Data-Quality.md
diff --git a/docs/UserGuide/UDF-Library/Data-Repairing.md b/docs/UserGuide/Operators-Functions/Data-Repairing.md
similarity index 100%
rename from docs/UserGuide/UDF-Library/Data-Repairing.md
rename to docs/UserGuide/Operators-Functions/Data-Repairing.md
diff --git a/docs/UserGuide/UDF-Library/Frequency-Domain.md b/docs/UserGuide/Operators-Functions/Frequency-Domain.md
similarity index 100%
rename from docs/UserGuide/UDF-Library/Frequency-Domain.md
rename to docs/UserGuide/Operators-Functions/Frequency-Domain.md
diff --git a/docs/UserGuide/Operators-Functions/Lambda.md b/docs/UserGuide/Operators-Functions/Lambda.md
new file mode 100644
index 0000000000..4c7dfd8524
--- /dev/null
+++ b/docs/UserGuide/Operators-Functions/Lambda.md
@@ -0,0 +1,77 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+        http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+# Lambda Expression
+
+## JEXL Function
+
+Java Expression Language (JEXL) is an expression language engine. We use JEXL to extend UDFs, which are implemented on the command line with simple lambda expressions. See the link for [operators supported in jexl lambda expressions](https://commons.apache.org/proper/commons-jexl/apidocs/org/apache/commons/jexl3/package-summary.html#customization).
+
+| Function Name | Allowed Input Series Data Types | Required Attributes                           | Output Series Data Type | Series Data Type  Description                 |
+|----------|--------------------------------|---------------------------------------|------------|--------------------------------------------------|
+| JEXL   | INT32 / INT64 / FLOAT / DOUBLE / TEXT / BOOLEAN | `expr` is a lambda expression that supports standard one or multi arguments in the form `x -> {...}` or `(x, y, z) -> {...}`, e.g. ` x -> {x * 2}`, `(x, y, z) -> {x + y * z}` | INT32 / INT64 / FLOAT / DOUBLE / TEXT / BOOLEAN | Returns the input time series transformed by a lambda expression |
+
+#### Demonstrate
+Example data: `root.ln.wf01.wt01.temperature`, `root.ln.wf01.wt01.st`, `root.ln.wf01.wt01.str` a total of `11` data.
+
+```
+IoTDB> select * from root.ln.wf01.wt01;
++-----------------------------+---------------------+--------------------+-----------------------------+
+|                         Time|root.ln.wf01.wt01.str|root.ln.wf01.wt01.st|root.ln.wf01.wt01.temperature|
++-----------------------------+---------------------+--------------------+-----------------------------+
+|1970-01-01T08:00:00.000+08:00|                  str|                10.0|                          0.0|
+|1970-01-01T08:00:00.001+08:00|                  str|                20.0|                          1.0|
+|1970-01-01T08:00:00.002+08:00|                  str|                30.0|                          2.0|
+|1970-01-01T08:00:00.003+08:00|                  str|                40.0|                          3.0|
+|1970-01-01T08:00:00.004+08:00|                  str|                50.0|                          4.0|
+|1970-01-01T08:00:00.005+08:00|                  str|                60.0|                          5.0|
+|1970-01-01T08:00:00.006+08:00|                  str|                70.0|                          6.0|
+|1970-01-01T08:00:00.007+08:00|                  str|                80.0|                          7.0|
+|1970-01-01T08:00:00.008+08:00|                  str|                90.0|                          8.0|
+|1970-01-01T08:00:00.009+08:00|                  str|               100.0|                          9.0|
+|1970-01-01T08:00:00.010+08:00|                  str|               110.0|                         10.0|
++-----------------------------+---------------------+--------------------+-----------------------------+
+```
+Sql:
+```sql
+select jexl(temperature, 'expr'='x -> {x + x}') as jexl1, jexl(temperature, 'expr'='x -> {x * 3}') as jexl2, jexl(temperature, 'expr'='x -> {x * x}') as jexl3, jexl(temperature, 'expr'='x -> {multiply(x, 100)}') as jexl4, jexl(temperature, st, 'expr'='(x, y) -> {x + y}') as jexl5, jexl(temperature, st, str, 'expr'='(x, y, z) -> {x + y + z}') as jexl6 from root.ln.wf01.wt01;```
+```
+
+Result:
+```
++-----------------------------+-----+-----+-----+------+-----+--------+
+|                         Time|jexl1|jexl2|jexl3| jexl4|jexl5|   jexl6|
++-----------------------------+-----+-----+-----+------+-----+--------+
+|1970-01-01T08:00:00.000+08:00|  0.0|  0.0|  0.0|   0.0| 10.0| 10.0str|
+|1970-01-01T08:00:00.001+08:00|  2.0|  3.0|  1.0| 100.0| 21.0| 21.0str|
+|1970-01-01T08:00:00.002+08:00|  4.0|  6.0|  4.0| 200.0| 32.0| 32.0str|
+|1970-01-01T08:00:00.003+08:00|  6.0|  9.0|  9.0| 300.0| 43.0| 43.0str|
+|1970-01-01T08:00:00.004+08:00|  8.0| 12.0| 16.0| 400.0| 54.0| 54.0str|
+|1970-01-01T08:00:00.005+08:00| 10.0| 15.0| 25.0| 500.0| 65.0| 65.0str|
+|1970-01-01T08:00:00.006+08:00| 12.0| 18.0| 36.0| 600.0| 76.0| 76.0str|
+|1970-01-01T08:00:00.007+08:00| 14.0| 21.0| 49.0| 700.0| 87.0| 87.0str|
+|1970-01-01T08:00:00.008+08:00| 16.0| 24.0| 64.0| 800.0| 98.0| 98.0str|
+|1970-01-01T08:00:00.009+08:00| 18.0| 27.0| 81.0| 900.0|109.0|109.0str|
+|1970-01-01T08:00:00.010+08:00| 20.0| 30.0|100.0|1000.0|120.0|120.0str|
++-----------------------------+-----+-----+-----+------+-----+--------+
+Total line number = 11
+It costs 0.118s
+```
diff --git a/docs/UserGuide/Operators-Functions/Logical.md b/docs/UserGuide/Operators-Functions/Logical.md
new file mode 100644
index 0000000000..1524870abf
--- /dev/null
+++ b/docs/UserGuide/Operators-Functions/Logical.md
@@ -0,0 +1,63 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+        http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+# Logical Operators
+
+## Unary Logical Operators
+
+Supported operator `!`
+
+Supported input data types: `BOOLEAN`
+
+Output data type: `BOOLEAN`
+
+Hint: the priority of `!` is the same as `-`. Remember to use brackets to modify priority.
+
+## Binary Logical Operators
+
+Supported operators AND:`and`,`&`, `&&`; OR:`or`,`|`,`||`
+
+Supported input data types: `BOOLEAN`
+
+Output data type: `BOOLEAN`
+
+Note: Only when the left operand and the right operand under a certain timestamp are both `BOOLEAN` type, the binary logic operation will have an output value.
+
+**Example:**
+
+```sql
+select a, b, a > 10, a <= b, !(a <= b), a > 10 && a > b from root.test;
+```
+
+运行结果
+```
+IoTDB> select a, b, a > 10, a <= b, !(a <= b), a > 10 && a > b from root.test;
++-----------------------------+-----------+-----------+----------------+--------------------------+---------------------------+------------------------------------------------+
+|                         Time|root.test.a|root.test.b|root.test.a > 10|root.test.a <= root.test.b|!root.test.a <= root.test.b|(root.test.a > 10) & (root.test.a > root.test.b)|
++-----------------------------+-----------+-----------+----------------+--------------------------+---------------------------+------------------------------------------------+
+|1970-01-01T08:00:00.001+08:00|         23|       10.0|            true|                     false|                       true|                                            true|
+|1970-01-01T08:00:00.002+08:00|         33|       21.0|            true|                     false|                       true|                                            true|
+|1970-01-01T08:00:00.004+08:00|         13|       15.0|            true|                      true|                      false|                                           false|
+|1970-01-01T08:00:00.005+08:00|         26|        0.0|            true|                     false|                       true|                                            true|
+|1970-01-01T08:00:00.008+08:00|          1|       22.0|           false|                      true|                      false|                                           false|
+|1970-01-01T08:00:00.010+08:00|         23|       12.0|            true|                     false|                       true|                                            true|
++-----------------------------+-----------+-----------+----------------+--------------------------+---------------------------+------------------------------------------------+
+```
\ No newline at end of file
diff --git a/docs/UserGuide/Operators-Functions/Mathematical.md b/docs/UserGuide/Operators-Functions/Mathematical.md
new file mode 100644
index 0000000000..f477e58c83
--- /dev/null
+++ b/docs/UserGuide/Operators-Functions/Mathematical.md
@@ -0,0 +1,113 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+        http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+## Arithmetic Operators and Functions
+
+## Arithmetic Operators
+
+### Unary Arithmetic Operators
+
+Supported operators: `+`, `-`
+
+Supported input data types: `INT32`, `INT64` and `FLOAT`
+
+Output data type: consistent with the input data type
+
+### Binary Arithmetic Operators
+
+Supported operators: `+`, `-`, `*`, `/`, `%`
+
+Supported input data types: `INT32`, `INT64`, `FLOAT` and `DOUBLE`
+
+Output data type: `DOUBLE`
+
+Note: Only when the left operand and the right operand under a certain timestamp are not  `null`, the binary arithmetic operation will have an output value.
+
+### Example
+
+```sql
+select s1, - s1, s2, + s2, s1 + s2, s1 - s2, s1 * s2, s1 / s2, s1 % s2 from root.sg.d1
+```
+
+Result:
+
+```
++-----------------------------+-------------+--------------+-------------+-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+
+|                         Time|root.sg.d1.s1|-root.sg.d1.s1|root.sg.d1.s2|root.sg.d1.s2|root.sg.d1.s1 + root.sg.d1.s2|root.sg.d1.s1 - root.sg.d1.s2|root.sg.d1.s1 * root.sg.d1.s2|root.sg.d1.s1 / root.sg.d1.s2|root.sg.d1.s1 % root.sg.d1.s2|
++-----------------------------+-------------+--------------+-------------+-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+
+|1970-01-01T08:00:00.001+08:00|          1.0|          -1.0|          1.0|          1.0|                          2.0|                          0.0|                          1.0|                          1.0|                          0.0|
+|1970-01-01T08:00:00.002+08:00|          2.0|          -2.0|          2.0|          2.0|                          4.0|                          0.0|                          4.0|                          1.0|                          0.0|
+|1970-01-01T08:00:00.003+08:00|          3.0|          -3.0|          3.0|          3.0|                          6.0|                          0.0|                          9.0|                          1.0|                          0.0|
+|1970-01-01T08:00:00.004+08:00|          4.0|          -4.0|          4.0|          4.0|                          8.0|                          0.0|                         16.0|                          1.0|                          0.0|
+|1970-01-01T08:00:00.005+08:00|          5.0|          -5.0|          5.0|          5.0|                         10.0|                          0.0|                         25.0|                          1.0|                          0.0|
++-----------------------------+-------------+--------------+-------------+-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+
+Total line number = 5
+It costs 0.014s
+```
+
+## Arithmetic Functions
+
+Currently, IoTDB supports the following mathematical functions. The behavior of these mathematical functions is consistent with the behavior of these functions in the Java Math standard library.
+
+| Function Name | Allowed Input Series Data Types | Output Series Data Type       | Corresponding Implementation in the Java Standard Library    |
+| ------------- | ------------------------------- | ----------------------------- | ------------------------------------------------------------ |
+| SIN           | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#sin(double)                                             |
+| COS           | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#cos(double)                                             |
+| TAN           | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#tan(double)                                             |
+| ASIN          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#asin(double)                                            |
+| ACOS          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#acos(double)                                            |
+| ATAN          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#atan(double)                                            |
+| SINH          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#sinh(double)                                            |
+| COSH          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#cosh(double)                                            |
+| TANH          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#tanh(double)                                            |
+| DEGREES       | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#toDegrees(double)                                       |
+| RADIANS       | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#toRadians(double)                                       |
+| ABS           | INT32 / INT64 / FLOAT / DOUBLE  | Same type as the input series | Math#abs(int) / Math#abs(long) /Math#abs(float) /Math#abs(double) |
+| SIGN          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#signum(double)                                          |
+| CEIL          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#ceil(double)                                            |
+| FLOOR         | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#floor(double)                                           |
+| ROUND         | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#rint(double)                                            |
+| EXP           | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#exp(double)                                             |
+| LN            | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#log(double)                                             |
+| LOG10         | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#log10(double)                                           |
+| SQRT          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#sqrt(double)                                            |
+
+Example:
+
+```   sql
+select s1, sin(s1), cos(s1), tan(s1) from root.sg1.d1 limit 5 offset 1000;
+```
+
+Result:
+
+```
++-----------------------------+-------------------+-------------------+--------------------+-------------------+
+|                         Time|     root.sg1.d1.s1|sin(root.sg1.d1.s1)| cos(root.sg1.d1.s1)|tan(root.sg1.d1.s1)|
++-----------------------------+-------------------+-------------------+--------------------+-------------------+
+|2020-12-10T17:11:49.037+08:00|7360723084922759782| 0.8133527237573284|  0.5817708713544664| 1.3980636773094157|
+|2020-12-10T17:11:49.038+08:00|4377791063319964531|-0.8938962705202537|  0.4482738644511651| -1.994085181866842|
+|2020-12-10T17:11:49.039+08:00|7972485567734642915| 0.9627757585308978|-0.27030138509681073|-3.5618602479083545|
+|2020-12-10T17:11:49.040+08:00|2508858212791964081|-0.6073417341629443| -0.7944406950452296| 0.7644897069734913|
+|2020-12-10T17:11:49.041+08:00|2817297431185141819|-0.8419358900502509| -0.5395775727782725| 1.5603611649667768|
++-----------------------------+-------------------+-------------------+--------------------+-------------------+
+Total line number = 5
+It costs 0.008s
+```
\ No newline at end of file
diff --git a/docs/UserGuide/UDF-Library/Quick-Start.md b/docs/UserGuide/Operators-Functions/Overview.md
similarity index 63%
rename from docs/UserGuide/UDF-Library/Quick-Start.md
rename to docs/UserGuide/Operators-Functions/Overview.md
index 5436880980..af44a10758 100644
--- a/docs/UserGuide/UDF-Library/Quick-Start.md
+++ b/docs/UserGuide/Operators-Functions/Overview.md
@@ -21,6 +21,30 @@
 
 # Quick Start
 
+## Priority of Operators
+
+|priority|operator  |meaning            |
+|:---:|:------------|:------------------|
+|1    |`-`          |Unary operator negative  |
+|1    |`+`          |Unary operator positive  |
+|1    |`!`          |Unary operator negation  |
+|2    |`*`          |Binary operator multiply |
+|2    |`/`          |Binary operator division |
+|2    |`%`          |Binary operator remainder|
+|3    |`+`          |Binary operator add      |
+|3    |`-`          |Binary operator minus    |
+|4    |`>`          |Binary compare operator greater than|
+|4    |`>=`         |Binary compare operator greater or equal to|
+|4    |`<`          |Binary compare operator less than|
+|4    |`<=`         |Binary compare operator less or equal to|
+|4    |`==`         |Binary compare operator equal to|
+|4    |`!=`/`<>`    |Binary compare operator non-equal to|
+|5      |`REGEXP`   |`REGEXP` operator|
+|5      |`LIKE`    |`LIKE` operator|
+|6      |`IN`    |`IN` operator|
+|7    |`and`/`&`/`&&`               |Binary logic operator and|
+|8    |`or`/ &#124; / &#124;&#124;  |Binary logic operator or|
+
 ## About
 For applications based on time series data, data quality is vital.
 **UDF Library** is IoTDB User Defined Functions (UDF) about data quality, including data profiling, data quality evalution and data repairing.
diff --git a/docs/UserGuide/Operators-Functions/Sample.md b/docs/UserGuide/Operators-Functions/Sample.md
new file mode 100644
index 0000000000..c638fbf88d
--- /dev/null
+++ b/docs/UserGuide/Operators-Functions/Sample.md
@@ -0,0 +1,389 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+        http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+# Sample Functions
+
+## Equal Size Bucket Sample Function
+
+### Equal Size Bucket Random Sample Function
+
+This function samples the input sequence in equal size buckets, that is, according to the downsampling ratio and downsampling method given by the user, the input sequence is equally divided into several buckets according to a fixed number of points. Sampling by the given sampling method within each bucket.
+- `proportion`: sample ratio, the value range is `(0, 1]`.
+#### Equal Size Bucket Random Sample
+Random sampling is performed on the equally divided buckets.
+
+| Function Name | Allowed Input Series Data Types | Required Attributes                           | Output Series Data Type | Series Data Type  Description                 |
+|----------|--------------------------------|---------------------------------------|------------|--------------------------------------------------|
+| EQUAL_SIZE_BUCKET_RANDOM_SAMPLE   | INT32 / INT64 / FLOAT / DOUBLE | `proportion` The value range is `(0, 1]`, the default is `0.1` | INT32 / INT64 / FLOAT / DOUBLE | Returns a random sample of equal buckets that matches the sampling ratio |
+
+Example data: `root.ln.wf01.wt01.temperature` has a total of `100` ordered data from `0.0-99.0`.
+```
+IoTDB> select temperature from root.ln.wf01.wt01;
++-----------------------------+-----------------------------+
+|                         Time|root.ln.wf01.wt01.temperature|
++-----------------------------+-----------------------------+
+|1970-01-01T08:00:00.000+08:00|                          0.0|
+|1970-01-01T08:00:00.001+08:00|                          1.0|
+|1970-01-01T08:00:00.002+08:00|                          2.0|
+|1970-01-01T08:00:00.003+08:00|                          3.0|
+|1970-01-01T08:00:00.004+08:00|                          4.0|
+|1970-01-01T08:00:00.005+08:00|                          5.0|
+|1970-01-01T08:00:00.006+08:00|                          6.0|
+|1970-01-01T08:00:00.007+08:00|                          7.0|
+|1970-01-01T08:00:00.008+08:00|                          8.0|
+|1970-01-01T08:00:00.009+08:00|                          9.0|
+|1970-01-01T08:00:00.010+08:00|                         10.0|
+|1970-01-01T08:00:00.011+08:00|                         11.0|
+|1970-01-01T08:00:00.012+08:00|                         12.0|
+|.............................|.............................|            
+|1970-01-01T08:00:00.089+08:00|                         89.0|
+|1970-01-01T08:00:00.090+08:00|                         90.0|
+|1970-01-01T08:00:00.091+08:00|                         91.0|
+|1970-01-01T08:00:00.092+08:00|                         92.0|
+|1970-01-01T08:00:00.093+08:00|                         93.0|
+|1970-01-01T08:00:00.094+08:00|                         94.0|
+|1970-01-01T08:00:00.095+08:00|                         95.0|
+|1970-01-01T08:00:00.096+08:00|                         96.0|
+|1970-01-01T08:00:00.097+08:00|                         97.0|
+|1970-01-01T08:00:00.098+08:00|                         98.0|
+|1970-01-01T08:00:00.099+08:00|                         99.0|
++-----------------------------+-----------------------------+
+```
+Sql:
+```sql
+select equal_size_bucket_random_sample(temperature,'proportion'='0.1') as random_sample from root.ln.wf01.wt01;
+```
+Result:
+```
++-----------------------------+-------------+
+|                         Time|random_sample|
++-----------------------------+-------------+
+|1970-01-01T08:00:00.007+08:00|          7.0|
+|1970-01-01T08:00:00.014+08:00|         14.0|
+|1970-01-01T08:00:00.020+08:00|         20.0|
+|1970-01-01T08:00:00.035+08:00|         35.0|
+|1970-01-01T08:00:00.047+08:00|         47.0|
+|1970-01-01T08:00:00.059+08:00|         59.0|
+|1970-01-01T08:00:00.063+08:00|         63.0|
+|1970-01-01T08:00:00.079+08:00|         79.0|
+|1970-01-01T08:00:00.086+08:00|         86.0|
+|1970-01-01T08:00:00.096+08:00|         96.0|
++-----------------------------+-------------+
+Total line number = 10
+It costs 0.024s
+```
+
+### Equal Size Bucket Aggregation Sample
+
+The input sequence is sampled by the aggregation sampling method, and the user needs to provide an additional aggregation function parameter, namely
+- `type`: Aggregate type, which can be `avg` or `max` or `min` or `sum` or `extreme` or `variance`. By default, `avg` is used. `extreme` represents the value with the largest absolute value in the equal bucket. `variance` represents the variance in the sampling equal buckets.
+
+The timestamp of the sampling output of each bucket is the timestamp of the first point of the bucket.
+
+| Function Name | Allowed Input Series Data Types | Required Attributes                           | Output Series Data Type | Series Data Type  Description                 |
+|----------|--------------------------------|---------------------------------------|------------|--------------------------------------------------|
+| EQUAL_SIZE_BUCKET_AGG_SAMPLE | INT32 / INT64 / FLOAT / DOUBLE | `proportion` The value range is `(0, 1]`, the default is `0.1`</br>`type`: The value types are `avg`, `max`, `min`, `sum`, `extreme`, `variance`, the default is `avg` | INT32 / INT64 / FLOAT / DOUBLE | Returns equal bucket aggregation samples that match the sampling ratio |
+
+Example data: `root.ln.wf01.wt01.temperature` has a total of `100` ordered data from `0.0-99.0`, and the test data is randomly sampled in equal buckets.
+
+Sql:
+```sql
+select equal_size_bucket_agg_sample(temperature, 'type'='avg','proportion'='0.1') as agg_avg, equal_size_bucket_agg_sample(temperature, 'type'='max','proportion'='0.1') as agg_max, equal_size_bucket_agg_sample(temperature,'type'='min','proportion'='0.1') as agg_min, equal_size_bucket_agg_sample(temperature, 'type'='sum','proportion'='0.1') as agg_sum, equal_size_bucket_agg_sample(temperature, 'type'='extreme','proportion'='0.1') as agg_extreme, equal_size_bucket_agg_sample(temperature, ' [...]
+```
+Result:
+```
++-----------------------------+-----------------+-------+-------+-------+-----------+------------+
+|                         Time|          agg_avg|agg_max|agg_min|agg_sum|agg_extreme|agg_variance|
++-----------------------------+-----------------+-------+-------+-------+-----------+------------+
+|1970-01-01T08:00:00.000+08:00|              4.5|    9.0|    0.0|   45.0|        9.0|        8.25|
+|1970-01-01T08:00:00.010+08:00|             14.5|   19.0|   10.0|  145.0|       19.0|        8.25|
+|1970-01-01T08:00:00.020+08:00|             24.5|   29.0|   20.0|  245.0|       29.0|        8.25|
+|1970-01-01T08:00:00.030+08:00|             34.5|   39.0|   30.0|  345.0|       39.0|        8.25|
+|1970-01-01T08:00:00.040+08:00|             44.5|   49.0|   40.0|  445.0|       49.0|        8.25|
+|1970-01-01T08:00:00.050+08:00|             54.5|   59.0|   50.0|  545.0|       59.0|        8.25|
+|1970-01-01T08:00:00.060+08:00|             64.5|   69.0|   60.0|  645.0|       69.0|        8.25|
+|1970-01-01T08:00:00.070+08:00|74.50000000000001|   79.0|   70.0|  745.0|       79.0|        8.25|
+|1970-01-01T08:00:00.080+08:00|             84.5|   89.0|   80.0|  845.0|       89.0|        8.25|
+|1970-01-01T08:00:00.090+08:00|             94.5|   99.0|   90.0|  945.0|       99.0|        8.25|
++-----------------------------+-----------------+-------+-------+-------+-----------+------------+
+Total line number = 10
+It costs 0.044s
+```
+
+### Equal Size Bucket M4 Sample
+
+The input sequence is sampled using the M4 sampling method. That is to sample the head, tail, min and max values for each bucket.
+
+| Function Name | Allowed Input Series Data Types | Required Attributes                           | Output Series Data Type | Series Data Type  Description                 |
+|----------|--------------------------------|---------------------------------------|------------|--------------------------------------------------|
+| EQUAL_SIZE_BUCKET_M4_SAMPLE | INT32 / INT64 / FLOAT / DOUBLE | `proportion` The value range is `(0, 1]`, the default is `0.1` | INT32 / INT64 / FLOAT / DOUBLE | Returns equal bucket M4 samples that match the sampling ratio |
+
+Example data: `root.ln.wf01.wt01.temperature` has a total of `100` ordered data from `0.0-99.0`, and the test data is randomly sampled in equal buckets.
+
+Sql:
+```sql
+select equal_size_bucket_m4_sample(temperature, 'proportion'='0.1') as M4_sample from root.ln.wf01.wt01;
+```
+Result:
+```
++-----------------------------+---------+
+|                         Time|M4_sample|
++-----------------------------+---------+
+|1970-01-01T08:00:00.000+08:00|      0.0|
+|1970-01-01T08:00:00.001+08:00|      1.0|
+|1970-01-01T08:00:00.038+08:00|     38.0|
+|1970-01-01T08:00:00.039+08:00|     39.0|
+|1970-01-01T08:00:00.040+08:00|     40.0|
+|1970-01-01T08:00:00.041+08:00|     41.0|
+|1970-01-01T08:00:00.078+08:00|     78.0|
+|1970-01-01T08:00:00.079+08:00|     79.0|
+|1970-01-01T08:00:00.080+08:00|     80.0|
+|1970-01-01T08:00:00.081+08:00|     81.0|
+|1970-01-01T08:00:00.098+08:00|     98.0|
+|1970-01-01T08:00:00.099+08:00|     99.0|
++-----------------------------+---------+
+Total line number = 12
+It costs 0.065s
+```
+
+#### Equal Size Bucket Outlier Sample
+
+This function samples the input sequence with equal number of bucket outliers, that is, according to the downsampling ratio given by the user and the number of samples in the bucket, the input sequence is divided into several buckets according to a fixed number of points. Sampling by the given outlier sampling method within each bucket.
+
+| Function Name | Allowed Input Series Data Types | Required Attributes                           | Output Series Data Type | Series Data Type  Description                 |
+|----------|--------------------------------|---------------------------------------|------------|--------------------------------------------------|
+| EQUAL_SIZE_BUCKET_OUTLIER_SAMPLE | INT32 / INT64 / FLOAT / DOUBLE | The value range of `proportion` is `(0, 1]`, the default is `0.1`</br> The value of `type` is `avg` or `stendis` or `cos` or `prenextdis`, the default is `avg` </br>The value of `number` should be greater than 0, the default is `3`| INT32 / INT64 / FLOAT / DOUBLE | Returns outlier samples in equal buckets that match the sampling ratio and the number of samples in the bucket |
+
+Parameter Description
+- `proportion`: sampling ratio
+- `number`: the number of samples in each bucket, default `3`
+- `type`: outlier sampling method, the value is
+  - `avg`: Take the average of the data points in the bucket, and find the `top number` farthest from the average according to the sampling ratio
+  - `stendis`: Take the vertical distance between each data point in the bucket and the first and last data points of the bucket to form a straight line, and according to the sampling ratio, find the `top number` with the largest distance
+  - `cos`: Set a data point in the bucket as b, the data point on the left of b as a, and the data point on the right of b as c, then take the cosine value of the angle between the ab and bc vectors. The larger the angle, the more likely it is an outlier. Find the `top number` with the smallest cos value
+  - `prenextdis`: Let a data point in the bucket be b, the data point to the left of b is a, and the data point to the right of b is c, then take the sum of the lengths of ab and bc as the yardstick, the larger the sum, the more likely it is to be an outlier, and find the `top number` with the largest sum value
+
+Example data: `root.ln.wf01.wt01.temperature` has a total of `100` ordered data from `0.0-99.0`. Among them, in order to add outliers, we make the number modulo 5 equal to 0 increment by 100.
+```
+IoTDB> select temperature from root.ln.wf01.wt01;
++-----------------------------+-----------------------------+
+|                         Time|root.ln.wf01.wt01.temperature|
++-----------------------------+-----------------------------+
+|1970-01-01T08:00:00.000+08:00|                          0.0|
+|1970-01-01T08:00:00.001+08:00|                          1.0|
+|1970-01-01T08:00:00.002+08:00|                          2.0|
+|1970-01-01T08:00:00.003+08:00|                          3.0|
+|1970-01-01T08:00:00.004+08:00|                          4.0|
+|1970-01-01T08:00:00.005+08:00|                        105.0|
+|1970-01-01T08:00:00.006+08:00|                          6.0|
+|1970-01-01T08:00:00.007+08:00|                          7.0|
+|1970-01-01T08:00:00.008+08:00|                          8.0|
+|1970-01-01T08:00:00.009+08:00|                          9.0|
+|1970-01-01T08:00:00.010+08:00|                         10.0|
+|1970-01-01T08:00:00.011+08:00|                         11.0|
+|1970-01-01T08:00:00.012+08:00|                         12.0|
+|1970-01-01T08:00:00.013+08:00|                         13.0|
+|1970-01-01T08:00:00.014+08:00|                         14.0|
+|1970-01-01T08:00:00.015+08:00|                        115.0|
+|1970-01-01T08:00:00.016+08:00|                         16.0|
+|.............................|.............................|
+|1970-01-01T08:00:00.092+08:00|                         92.0|
+|1970-01-01T08:00:00.093+08:00|                         93.0|
+|1970-01-01T08:00:00.094+08:00|                         94.0|
+|1970-01-01T08:00:00.095+08:00|                        195.0|
+|1970-01-01T08:00:00.096+08:00|                         96.0|
+|1970-01-01T08:00:00.097+08:00|                         97.0|
+|1970-01-01T08:00:00.098+08:00|                         98.0|
+|1970-01-01T08:00:00.099+08:00|                         99.0|
++-----------------------------+-----------------------------+
+```
+Sql:
+```sql
+select equal_size_bucket_outlier_sample(temperature, 'proportion'='0.1', 'type'='avg', 'number'='2') as outlier_avg_sample, equal_size_bucket_outlier_sample(temperature, 'proportion'='0.1', 'type'='stendis', 'number'='2') as outlier_stendis_sample, equal_size_bucket_outlier_sample(temperature, 'proportion'='0.1', 'type'='cos', 'number'='2') as outlier_cos_sample, equal_size_bucket_outlier_sample(temperature, 'proportion'='0.1', 'type'='prenextdis', 'number'='2') as outlier_prenextdis_sam [...]
+```
+Result:
+```
++-----------------------------+------------------+----------------------+------------------+-------------------------+
+|                         Time|outlier_avg_sample|outlier_stendis_sample|outlier_cos_sample|outlier_prenextdis_sample|
++-----------------------------+------------------+----------------------+------------------+-------------------------+
+|1970-01-01T08:00:00.005+08:00|             105.0|                 105.0|             105.0|                    105.0|
+|1970-01-01T08:00:00.015+08:00|             115.0|                 115.0|             115.0|                    115.0|
+|1970-01-01T08:00:00.025+08:00|             125.0|                 125.0|             125.0|                    125.0|
+|1970-01-01T08:00:00.035+08:00|             135.0|                 135.0|             135.0|                    135.0|
+|1970-01-01T08:00:00.045+08:00|             145.0|                 145.0|             145.0|                    145.0|
+|1970-01-01T08:00:00.055+08:00|             155.0|                 155.0|             155.0|                    155.0|
+|1970-01-01T08:00:00.065+08:00|             165.0|                 165.0|             165.0|                    165.0|
+|1970-01-01T08:00:00.075+08:00|             175.0|                 175.0|             175.0|                    175.0|
+|1970-01-01T08:00:00.085+08:00|             185.0|                 185.0|             185.0|                    185.0|
+|1970-01-01T08:00:00.095+08:00|             195.0|                 195.0|             195.0|                    195.0|
++-----------------------------+------------------+----------------------+------------------+-------------------------+
+Total line number = 10
+It costs 0.041s
+```
+
+## M4 Function
+
+M4 is used to sample the `first, last, bottom, top` points for each sliding window:
+
+-   the first point is the point with the **m**inimal time;
+-   the last point is the point with the **m**aximal time;
+-   the bottom point is the point with the **m**inimal value (if there are multiple such points, M4 returns one of them);
+-   the top point is the point with the **m**aximal value (if there are multiple such points, M4 returns one of them).
+
+<img src="https://user-images.githubusercontent.com/33376433/198178733-a0919d17-0663-4672-9c4f-1efad6f463c2.png" alt="image" style="zoom:50%;" />
+
+| Function Name | Allowed Input Series Data Types | Attributes                                                   | Output Series Data Type        | Series Data Type  Description                                |
+| ------------- | ------------------------------- | ------------------------------------------------------------ | ------------------------------ | ------------------------------------------------------------ |
+| M4            | INT32 / INT64 / FLOAT / DOUBLE  | Different attributes used by the size window and the time window. The size window uses attributes `windowSize` and `slidingStep`. The time window uses attributes `timeInterval`, `slidingStep`, `displayWindowBegin`, and `displayWindowEnd`. More details see below. | INT32 / INT64 / FLOAT / DOUBLE | Returns the `first, last, bottom, top` points in each sliding window. M4 sorts and deduplicates the aggregated points within the window before [...]
+
+### Attributes
+
+**(1) Attributes for the size window:**
+
++ `windowSize`: The number of points in a window. Int data type. **Required**.
++ `slidingStep`: Slide a window by the number of points. Int data type. Optional. If not set, default to the same as `windowSize`.
+
+<img src="https://user-images.githubusercontent.com/33376433/198181449-00d563c8-7bce-4ecd-a031-ec120ca42c3f.png" alt="image" style="zoom: 50%;" />
+
+*(image source: https://iotdb.apache.org/UserGuide/Master/Process-Data/UDF-User-Defined-Function.html#udtf-user-defined-timeseries-generating-function)*
+
+**(2) Attributes for the time window:**
+
++ `timeInterval`: The time interval length of a window. Long data type. **Required**.
++ `slidingStep`: Slide a window by the time length. Long data type. Optional. If not set, default to the same as `timeInterval`.
++ `displayWindowBegin`: The starting position of the window (included). Long data type. Optional. If not set, default to Long.MIN_VALUE, meaning using the time of the first data point of the input time series as the starting position of the window.
++ `displayWindowEnd`: End time limit (excluded, essentially playing the same role as `WHERE time < displayWindowEnd`). Long data type. Optional. If not set, default to Long.MAX_VALUE, meaning there is no additional end time limit other than the end of the input time series itself.
+
+<img src="https://user-images.githubusercontent.com/33376433/198183015-93b56644-3330-4acf-ae9e-d718a02b5f4c.png" alt="groupBy window" style="zoom: 67%;" />
+
+*(image source: https://iotdb.apache.org/UserGuide/Master/Query-Data/Aggregate-Query.html#downsampling-aggregate-query)*
+
+### Examples
+
+Input series:
+
+```sql
++-----------------------------+------------------+
+|                         Time|root.vehicle.d1.s1|
++-----------------------------+------------------+
+|1970-01-01T08:00:00.001+08:00|               5.0|
+|1970-01-01T08:00:00.002+08:00|              15.0|
+|1970-01-01T08:00:00.005+08:00|              10.0|
+|1970-01-01T08:00:00.008+08:00|               8.0|
+|1970-01-01T08:00:00.010+08:00|              30.0|
+|1970-01-01T08:00:00.020+08:00|              20.0|
+|1970-01-01T08:00:00.025+08:00|               8.0|
+|1970-01-01T08:00:00.027+08:00|              20.0|
+|1970-01-01T08:00:00.030+08:00|              40.0|
+|1970-01-01T08:00:00.033+08:00|               9.0|
+|1970-01-01T08:00:00.035+08:00|              10.0|
+|1970-01-01T08:00:00.040+08:00|              20.0|
+|1970-01-01T08:00:00.045+08:00|              30.0|
+|1970-01-01T08:00:00.052+08:00|               8.0|
+|1970-01-01T08:00:00.054+08:00|              18.0|
++-----------------------------+------------------+
+```
+
+SQL for query1:
+
+```sql
+select M4(s1,'timeInterval'='25','displayWindowBegin'='0','displayWindowEnd'='100') from root.vehicle.d1
+```
+
+Output1:
+
+```sql
++-----------------------------+-----------------------------------------------------------------------------------------------+
+|                         Time|M4(root.vehicle.d1.s1, "timeInterval"="25", "displayWindowBegin"="0", "displayWindowEnd"="100")|
++-----------------------------+-----------------------------------------------------------------------------------------------+
+|1970-01-01T08:00:00.001+08:00|                                                                                            5.0|
+|1970-01-01T08:00:00.010+08:00|                                                                                           30.0|
+|1970-01-01T08:00:00.020+08:00|                                                                                           20.0|
+|1970-01-01T08:00:00.025+08:00|                                                                                            8.0|
+|1970-01-01T08:00:00.030+08:00|                                                                                           40.0|
+|1970-01-01T08:00:00.045+08:00|                                                                                           30.0|
+|1970-01-01T08:00:00.052+08:00|                                                                                            8.0|
+|1970-01-01T08:00:00.054+08:00|                                                                                           18.0|
++-----------------------------+-----------------------------------------------------------------------------------------------+
+Total line number = 8
+```
+
+SQL for query2:
+
+```sql
+select M4(s1,'windowSize'='10') from root.vehicle.d1
+```
+
+Output2:
+
+```sql
++-----------------------------+-----------------------------------------+
+|                         Time|M4(root.vehicle.d1.s1, "windowSize"="10")|
++-----------------------------+-----------------------------------------+
+|1970-01-01T08:00:00.001+08:00|                                      5.0|
+|1970-01-01T08:00:00.030+08:00|                                     40.0|
+|1970-01-01T08:00:00.033+08:00|                                      9.0|
+|1970-01-01T08:00:00.035+08:00|                                     10.0|
+|1970-01-01T08:00:00.045+08:00|                                     30.0|
+|1970-01-01T08:00:00.052+08:00|                                      8.0|
+|1970-01-01T08:00:00.054+08:00|                                     18.0|
++-----------------------------+-----------------------------------------+
+Total line number = 7
+```
+ 
+### Suggested Use Cases
+
+**(1) Use Case: Extreme-point-preserving downsampling**
+
+As M4 aggregation selects the `first, last, bottom, top` points for each window, M4 usually preserves extreme points and thus patterns better than other downsampling methods such as Piecewise Aggregate Approximation (PAA). Therefore, if you want to downsample the time series while preserving extreme points, you may give M4 a try.
+
+**(2) Use case: Error-free two-color line chart visualization of large-scale time series using reduced data**
+
+Refer to paper: ["M4: A Visualization-Oriented Time Series Data Aggregation"](http://www.vldb.org/pvldb/vol7/p797-jugel.pdf).
+
+Given a chart of `w*h` pixels, suppose the visualization time range of the time series root.vehicle.d1.s1 is `[tqs,tqe)`(in this use case please extend tqe to make sure (tqe-tqs) is divisible by w), the points that fall within the  `i`-th time span `Ii=[tqs+(tqe-tqs)/w*(i-1),tqs+(tqe-tqs)/w*i)` will be drawn on the `i`-th pixel column, i=1,2,...,w.
+
+Therefore, from a visualization-driven perspective, use the sql: `"select M4(s1,'timeInterval'='(tqe-tqs)/w','displayWindowBegin'='tqs','displayWindowEnd'='tqe') from root.vehicle.d1"` to sample the `first, last, bottom, top` points for each time span. The resulting series has no more than `4*w` points, a big reduction compared to the original large-scale time series. The line chart drawn from the reduced data is identical that to that drawn from the original data (pixel-level consistency).
+
+### Comparison with Other SQL
+
+| SQL                                                          | Whether support M4 aggregation                               | Sliding window type                               | Example                                                      | Docs                                                         |
+| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
+| 1. native built-in aggregate functions with Group By clause  | No. Lack `BOTTOM_TIME` and `TOP_TIME`, which are respectively the time of the points that have the mininum and maximum value. | Time Window                                       | `select count(status), max_value(temperature) from root.ln.wf01.wt01 group by ([2017-11-01 00:00:00, 2017-11-07 23:00:00), 3h, 1d)` | https://iotdb.apache.org/UserGuide/Master/Query-Data/Aggregate-Query.html#built-in-aggregate-functions <br />http [...]
+| 2. EQUAL_SIZE_BUCKET_M4_SAMPLE (built-in UDF)                | Yes*                                                         | Size Window. `windowSize = 4*(int)(1/proportion)` | `select equal_size_bucket_m4_sample(temperature, 'proportion'='0.1') as M4_sample from root.ln.wf01.wt01` | https://iotdb.apache.org/UserGuide/Master/Query-Data/Select-Expression.html#time-series-generating-functions |
+| **3. M4 (built-in UDF)**                                     | Yes*                                                         | Size Window, Time Window                          | (1) Size Window: `select M4(s1,'windowSize'='10') from root.vehicle.d1` <br />(2) Time Window: `select M4(s1,'timeInterval'='25','displayWindowBegin'='0','displayWindowEnd'='100') from root.vehicle.d1` | refer to this doc                                            |
+| 4. extend native built-in aggregate functions with Group By clause to support M4 aggregation | not implemented                                              | not implemented                                   | not implemented                                              | not implemented                                              |
+
+Further compare `EQUAL_SIZE_BUCKET_M4_SAMPLE` and `M4`:
+
+**(1) Different M4 aggregation definition:**
+
+For each window, `EQUAL_SIZE_BUCKET_M4_SAMPLE` extracts the top and bottom points from points **EXCLUDING** the first and last points.
+
+In contrast, `M4` extracts the top and bottom points from points **INCLUDING** the first and last points, which is more consistent with the semantics of `max_value` and `min_value` stored in metadata.
+
+It is worth noting that both functions sort and deduplicate the aggregated points in a window before outputting them to the collectors.
+
+**(2) Different sliding windows:** 
+
+`EQUAL_SIZE_BUCKET_M4_SAMPLE` uses SlidingSizeWindowAccessStrategy and **indirectly** controls sliding window size by sampling proportion. The conversion formula is `windowSize = 4*(int)(1/proportion)`. 
+
+`M4` supports two types of sliding window: SlidingSizeWindowAccessStrategy and SlidingTimeWindowAccessStrategy. `M4` **directly** controls the window point size or time length using corresponding parameters.
\ No newline at end of file
diff --git a/docs/UserGuide/Operators-Functions/Selection.md b/docs/UserGuide/Operators-Functions/Selection.md
new file mode 100644
index 0000000000..9a276bed71
--- /dev/null
+++ b/docs/UserGuide/Operators-Functions/Selection.md
@@ -0,0 +1,51 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+        http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+## Selector Functions
+
+Currently, IoTDB supports the following selector functions:
+
+| Function Name | Allowed Input Series Data Types       | Required Attributes                                          | Output Series Data Type       | Description                                                  |
+| ------------- | ------------------------------------- | ------------------------------------------------------------ | ----------------------------- | ------------------------------------------------------------ |
+| TOP_K         | INT32 / INT64 / FLOAT / DOUBLE / TEXT | `k`: the maximum number of selected data points, must be greater than 0 and less than or equal to 1000 | Same type as the input series | Returns `k` data points with the largest values in a time series. |
+| BOTTOM_K      | INT32 / INT64 / FLOAT / DOUBLE / TEXT | `k`: the maximum number of selected data points, must be greater than 0 and less than or equal to 1000 | Same type as the input series | Returns `k` data points with the smallest values in a time series. |
+
+Example:
+
+```   sql
+select s1, top_k(s1, 'k'='2'), bottom_k(s1, 'k'='2') from root.sg1.d2 where time > 2020-12-10T20:36:15.530+08:00;
+```
+
+Result:
+
+``` 
++-----------------------------+--------------------+------------------------------+---------------------------------+
+|                         Time|      root.sg1.d2.s1|top_k(root.sg1.d2.s1, "k"="2")|bottom_k(root.sg1.d2.s1, "k"="2")|
++-----------------------------+--------------------+------------------------------+---------------------------------+
+|2020-12-10T20:36:15.531+08:00| 1531604122307244742|           1531604122307244742|                             null|
+|2020-12-10T20:36:15.532+08:00|-7426070874923281101|                          null|                             null|
+|2020-12-10T20:36:15.533+08:00|-7162825364312197604|          -7162825364312197604|                             null|
+|2020-12-10T20:36:15.534+08:00|-8581625725655917595|                          null|             -8581625725655917595|
+|2020-12-10T20:36:15.535+08:00|-7667364751255535391|                          null|             -7667364751255535391|
++-----------------------------+--------------------+------------------------------+---------------------------------+
+Total line number = 5
+It costs 0.006s
+```
\ No newline at end of file
diff --git a/docs/UserGuide/UDF-Library/Series-Discovery.md b/docs/UserGuide/Operators-Functions/Series-Discovery.md
similarity index 100%
rename from docs/UserGuide/UDF-Library/Series-Discovery.md
rename to docs/UserGuide/Operators-Functions/Series-Discovery.md
diff --git a/docs/UserGuide/UDF-Library/String-Processing.md b/docs/UserGuide/Operators-Functions/String.md
similarity index 92%
rename from docs/UserGuide/UDF-Library/String-Processing.md
rename to docs/UserGuide/Operators-Functions/String.md
index 5d3e4e9cf3..653b057d95 100644
--- a/docs/UserGuide/UDF-Library/String-Processing.md
+++ b/docs/UserGuide/Operators-Functions/String.md
@@ -21,6 +21,72 @@
 
 # String Processing
 
+## STRING_CONTAINS
+
+### Function introduction
+
+This function checks whether the substring `s` exists in the string
+
+**Function name:** STRING_CONTAINS
+
+**Input sequence:** Only a single input sequence is supported, the type is TEXT.
+
+**parameter:**
++ `s`: The string to search for.
+
+**Output Sequence:** Output a single sequence, the type is BOOLEAN.
+
+### Usage example
+
+```   sql
+select s1, string_contains(s1, 's'='warn') from root.sg1.d4;
+```
+
+``` 
++-----------------------------+--------------+-------------------------------------------+
+|                         Time|root.sg1.d4.s1|string_contains(root.sg1.d4.s1, "s"="warn")|
++-----------------------------+--------------+-------------------------------------------+
+|1970-01-01T08:00:00.001+08:00|    warn:-8721|                                       true|
+|1970-01-01T08:00:00.002+08:00|  error:-37229|                                      false|
+|1970-01-01T08:00:00.003+08:00|     warn:1731|                                       true|
++-----------------------------+--------------+-------------------------------------------+
+Total line number = 3
+It costs 0.007s
+```
+
+## STRING_MATCHES
+
+### Function introduction
+
+This function judges whether a string can be matched by the regular expression `regex`.
+
+**Function name:** STRING_MATCHES
+
+**Input sequence:** Only a single input sequence is supported, the type is TEXT.
+
+**parameter:**
++ `regex`: Java standard library-style regular expressions.
+
+**Output Sequence:** Output a single sequence, the type is BOOLEAN.
+
+### Usage example
+
+```sql
+select s1, string_matches(s1, 'regex'='[^\\s]+37229') from root.sg1.d4;
+```
+
+```
++-----------------------------+--------------+------------------------------------------------------+
+|                         Time|root.sg1.d4.s1|string_matches(root.sg1.d4.s1, "regex"="[^\\s]+37229")|
++-----------------------------+--------------+------------------------------------------------------+
+|1970-01-01T08:00:00.001+08:00|    warn:-8721|                                                 false|
+|1970-01-01T08:00:00.002+08:00|  error:-37229|                                                  true|
+|1970-01-01T08:00:00.003+08:00|     warn:1731|                                                 false|
++-----------------------------+--------------+------------------------------------------------------+
+Total line number = 3
+It costs 0.007s
+```
+
 ## Length
 
 ### Usage
diff --git a/docs/UserGuide/UDF-Library/Series-Processing.md b/docs/UserGuide/Operators-Functions/Time-Series.md
similarity index 99%
rename from docs/UserGuide/UDF-Library/Series-Processing.md
rename to docs/UserGuide/Operators-Functions/Time-Series.md
index 94f3195ae5..531474bfef 100644
--- a/docs/UserGuide/UDF-Library/Series-Processing.md
+++ b/docs/UserGuide/Operators-Functions/Time-Series.md
@@ -19,7 +19,7 @@
 
 -->
 
-# Series Processing
+# Time Series Processing
 
 ## CHANGE_POINTS
 
diff --git a/docs/UserGuide/Process-Data/UDF-User-Defined-Function.md b/docs/UserGuide/Operators-Functions/User-Defined-Function.md
similarity index 99%
rename from docs/UserGuide/Process-Data/UDF-User-Defined-Function.md
rename to docs/UserGuide/Operators-Functions/User-Defined-Function.md
index d28392a250..52cb957418 100644
--- a/docs/UserGuide/Process-Data/UDF-User-Defined-Function.md
+++ b/docs/UserGuide/Operators-Functions/User-Defined-Function.md
@@ -20,7 +20,6 @@
 -->
 
 
-
 # User Defined Function (UDF)
 
 IoTDB provides a variety of built-in functions to meet your computing needs, and you can also create user defined functions to meet more computing needs. 
@@ -28,7 +27,6 @@ IoTDB provides a variety of built-in functions to meet your computing needs, and
 This document describes how to write, register and use a UDF.
 
 
-
 ## UDF Types
 
 In IoTDB, you can expand two types of UDF:
diff --git a/docs/UserGuide/Operators-Functions/Variation-Trend.md b/docs/UserGuide/Operators-Functions/Variation-Trend.md
new file mode 100644
index 0000000000..f412c7c0d1
--- /dev/null
+++ b/docs/UserGuide/Operators-Functions/Variation-Trend.md
@@ -0,0 +1,54 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+        http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+# Variation Trend Calculation Functions
+
+Currently, IoTDB supports the following variation trend calculation functions:
+
+| Function Name           | Allowed Input Series Data Types                 | Output Series Data Type       | Description                                                  |
+| ----------------------- | ----------------------------------------------- | ----------------------------- | ------------------------------------------------------------ |
+| TIME_DIFFERENCE         | INT32 / INT64 / FLOAT / DOUBLE / BOOLEAN / TEXT | INT64                         | Calculates the difference between the time stamp of a data point and the time stamp of the previous data point. There is no corresponding output for the first data point. |
+| DIFFERENCE              | INT32 / INT64 / FLOAT / DOUBLE                  | Same type as the input series | Calculates the difference between the value of a data point and the value of the previous data point. There is no corresponding output for the first data point. |
+| NON_NEGATIVE_DIFFERENCE | INT32 / INT64 / FLOAT / DOUBLE                  | Same type as the input series | Calculates the absolute value of the difference between the value of a data point and the value of the previous data point. There is no corresponding output for the first data point. |
+| DERIVATIVE              | INT32 / INT64 / FLOAT / DOUBLE                  | DOUBLE                        | Calculates the rate of change of a data point compared to the previous data point, the result is equals to DIFFERENCE / TIME_DIFFERENCE. There is no corresponding output for the first data point. |
+| NON_NEGATIVE_DERIVATIVE | INT32 / INT64 / FLOAT / DOUBLE                  | DOUBLE                        | Calculates the absolute value of the rate of change of a data point compared to the previous data point, the result is equals to NON_NEGATIVE_DIFFERENCE / TIME_DIFFERENCE. There is no corresponding output for the first data point. |
+
+Example:
+
+```   sql
+select s1, time_difference(s1), difference(s1), non_negative_difference(s1), derivative(s1), non_negative_derivative(s1) from root.sg1.d1 limit 5 offset 1000; 
+```
+
+Result:
+
+``` 
++-----------------------------+-------------------+-------------------------------+--------------------------+---------------------------------------+--------------------------+---------------------------------------+
+|                         Time|     root.sg1.d1.s1|time_difference(root.sg1.d1.s1)|difference(root.sg1.d1.s1)|non_negative_difference(root.sg1.d1.s1)|derivative(root.sg1.d1.s1)|non_negative_derivative(root.sg1.d1.s1)|
++-----------------------------+-------------------+-------------------------------+--------------------------+---------------------------------------+--------------------------+---------------------------------------+
+|2020-12-10T17:11:49.037+08:00|7360723084922759782|                              1|      -8431715764844238876|                    8431715764844238876|    -8.4317157648442388E18|                  8.4317157648442388E18|
+|2020-12-10T17:11:49.038+08:00|4377791063319964531|                              1|      -2982932021602795251|                    2982932021602795251|     -2.982932021602795E18|                   2.982932021602795E18|
+|2020-12-10T17:11:49.039+08:00|7972485567734642915|                              1|       3594694504414678384|                    3594694504414678384|     3.5946945044146785E18|                  3.5946945044146785E18|
+|2020-12-10T17:11:49.040+08:00|2508858212791964081|                              1|      -5463627354942678834|                    5463627354942678834|     -5.463627354942679E18|                   5.463627354942679E18|
+|2020-12-10T17:11:49.041+08:00|2817297431185141819|                              1|        308439218393177738|                     308439218393177738|     3.0843921839317773E17|                  3.0843921839317773E17|
++-----------------------------+-------------------+-------------------------------+--------------------------+---------------------------------------+--------------------------+---------------------------------------+
+Total line number = 5
+It costs 0.014s
+```
\ No newline at end of file
diff --git a/docs/UserGuide/Query-Data/Result-Format.md b/docs/UserGuide/Query-Data/Align-By.md
similarity index 98%
rename from docs/UserGuide/Query-Data/Result-Format.md
rename to docs/UserGuide/Query-Data/Align-By.md
index 6373594aca..87e11f8194 100644
--- a/docs/UserGuide/Query-Data/Result-Format.md
+++ b/docs/UserGuide/Query-Data/Align-By.md
@@ -19,7 +19,7 @@
 
 -->
 
-# Query Result Alignment
+# Query Alignment Mode
 
 In addition, IoTDB supports another result set format: `ALIGN BY DEVICE`.
 
diff --git a/docs/UserGuide/Process-Data/Continuous-Query.md b/docs/UserGuide/Query-Data/Continuous-Query.md
similarity index 100%
rename from docs/UserGuide/Process-Data/Continuous-Query.md
rename to docs/UserGuide/Query-Data/Continuous-Query.md
diff --git a/docs/UserGuide/Query-Data/Fill-Null-Value.md b/docs/UserGuide/Query-Data/Fill.md
similarity index 100%
rename from docs/UserGuide/Query-Data/Fill-Null-Value.md
rename to docs/UserGuide/Query-Data/Fill.md
diff --git a/docs/UserGuide/Query-Data/Aggregate-Query.md b/docs/UserGuide/Query-Data/Group-By.md
similarity index 82%
rename from docs/UserGuide/Query-Data/Aggregate-Query.md
rename to docs/UserGuide/Query-Data/Group-By.md
index bf7100c825..41d14a4f4c 100644
--- a/docs/UserGuide/Query-Data/Aggregate-Query.md
+++ b/docs/UserGuide/Query-Data/Group-By.md
@@ -19,51 +19,7 @@
 
 -->
 
-# Aggregate
-
-This section mainly introduces the related examples of aggregate query.
-
-> Please note that mixed use of `Aggregate Query` and `Timeseries Query` is not allowed. Below are examples for queries that are not allowed.
->
-> ```
-> select a, count(a) from root.sg 
-> select sin(a), count(a) from root.sg
-> select a, count(a) from root.sg group by ([10,100),10ms)
-> ```
-
-## Built-in Aggregate Functions
-
-The aggregate functions supported by IoTDB are as follows:
-
-| Function Name | Function Description                                         | Allowed Input Data Types | Output Data Types                   |
-| ------------- | ------------------------------------------------------------ | ------------------------ | ----------------------------------- |
-| SUM           | Summation.                                                   | INT32 INT64 FLOAT DOUBLE | DOUBLE                              |
-| COUNT         | Counts the number of data points.                            | All types                | INT                                 |
-| AVG           | Average.                                                     | INT32 INT64 FLOAT DOUBLE | DOUBLE                              |
-| EXTREME       | Finds the value with the largest absolute value. Returns a positive value if the maximum absolute value of positive and negative values is equal. | INT32 INT64 FLOAT DOUBLE | Consistent with the input data type |
-| MAX_VALUE     | Find the maximum value.                                      | INT32 INT64 FLOAT DOUBLE | Consistent with the input data type |
-| MIN_VALUE     | Find the minimum value.                                      | INT32 INT64 FLOAT DOUBLE | Consistent with the input data type |
-| FIRST_VALUE   | Find the value with the smallest timestamp.                  | All data types           | Consistent with input data type     |
-| LAST_VALUE    | Find the value with the largest timestamp.                   | All data types           | Consistent with input data type     |
-| MAX_TIME      | Find the maximum timestamp.                                  | All data Types           | Timestamp                           |
-| MIN_TIME      | Find the minimum timestamp.                                  | All data Types           | Timestamp                           |
-
-**Example:** Count Points
-
-```sql
-select count(status) from root.ln.wf01.wt01;
-```
-Result:
-
-```
-+-------------------------------+
-|count(root.ln.wf01.wt01.status)|
-+-------------------------------+
-|                          10080|
-+-------------------------------+
-Total line number = 1
-It costs 0.016s
-```
+# Group By Aggregate
 
 ## Aggregation By Level
 
@@ -626,98 +582,4 @@ As this feature is still under development, some queries have not been completed
 > 3. Temporarily not support `LIMIT`,`OFFSET`,`SLIMIT`,`SOFFSET`.
 > 4. Temporarily not support `ALIGN BY DEVICE`.
 > 5. Temporarily not support expressions as aggregation function parameter,e.g. `count(s+1)`.
-> 6. Not support the value filter, which stands the same with the `GROUP BY LEVEL` query.
-
-## Aggregate result filtering
-
-If you want to filter the results of aggregate queries, 
-you can use the `HAVING` clause after the `GROUP BY` clause.
-
-> NOTE:
->
-> 1.The expression in HAVING clause must consist of aggregate values; the original sequence cannot appear alone.
-> The following usages are incorrect:
-> ```sql
-> select count(s1) from root.** group by ([1,3),1ms) having sum(s1) > s1
-> select count(s1) from root.** group by ([1,3),1ms) having s1 > 1
-> ```
-> 2.When filtering the `GROUP BY LEVEL` result, the PATH in `SELECT` and `HAVING` can only have one node.
-> The following usages are incorrect:
-> ```sql
-> select count(s1) from root.** group by ([1,3),1ms), level=1 having sum(d1.s1) > 1
-> select count(d1.s1) from root.** group by ([1,3),1ms), level=1 having sum(s1) > 1
-> ```
-
-Here are a few examples of using the 'HAVING' clause to filter aggregate results.
-
-Aggregation result 1:
-
-```
-+-----------------------------+---------------------+---------------------+
-|                         Time|count(root.test.*.s1)|count(root.test.*.s2)|
-+-----------------------------+---------------------+---------------------+
-|1970-01-01T08:00:00.001+08:00|                    4|                    4|
-|1970-01-01T08:00:00.003+08:00|                    1|                    0|
-|1970-01-01T08:00:00.005+08:00|                    2|                    4|
-|1970-01-01T08:00:00.007+08:00|                    3|                    2|
-|1970-01-01T08:00:00.009+08:00|                    4|                    4|
-+-----------------------------+---------------------+---------------------+
-```
-
-Aggregation result filtering query 1:
-
-```sql
- select count(s1) from root.** group by ([1,11),2ms), level=1 having count(s2) > 1
-```
-
-Filtering result 1:
-
-```
-+-----------------------------+---------------------+
-|                         Time|count(root.test.*.s1)|
-+-----------------------------+---------------------+
-|1970-01-01T08:00:00.001+08:00|                    4|
-|1970-01-01T08:00:00.005+08:00|                    2|
-|1970-01-01T08:00:00.009+08:00|                    4|
-+-----------------------------+---------------------+
-```
-
-Aggregation result 2:
-
-```
-+-----------------------------+-------------+---------+---------+
-|                         Time|       Device|count(s1)|count(s2)|
-+-----------------------------+-------------+---------+---------+
-|1970-01-01T08:00:00.001+08:00|root.test.sg1|        1|        2|
-|1970-01-01T08:00:00.003+08:00|root.test.sg1|        1|        0|
-|1970-01-01T08:00:00.005+08:00|root.test.sg1|        1|        2|
-|1970-01-01T08:00:00.007+08:00|root.test.sg1|        2|        1|
-|1970-01-01T08:00:00.009+08:00|root.test.sg1|        2|        2|
-|1970-01-01T08:00:00.001+08:00|root.test.sg2|        2|        2|
-|1970-01-01T08:00:00.003+08:00|root.test.sg2|        0|        0|
-|1970-01-01T08:00:00.005+08:00|root.test.sg2|        1|        2|
-|1970-01-01T08:00:00.007+08:00|root.test.sg2|        1|        1|
-|1970-01-01T08:00:00.009+08:00|root.test.sg2|        2|        2|
-+-----------------------------+-------------+---------+---------+
-```
-
-Aggregation result filtering query 2:
-
-```sql
- select count(s1), count(s2) from root.** group by ([1,11),2ms) having count(s2) > 1 align by device
-```
-
-Filtering result 2:
-
-```
-+-----------------------------+-------------+---------+---------+
-|                         Time|       Device|count(s1)|count(s2)|
-+-----------------------------+-------------+---------+---------+
-|1970-01-01T08:00:00.001+08:00|root.test.sg1|        1|        2|
-|1970-01-01T08:00:00.005+08:00|root.test.sg1|        1|        2|
-|1970-01-01T08:00:00.009+08:00|root.test.sg1|        2|        2|
-|1970-01-01T08:00:00.001+08:00|root.test.sg2|        2|        2|
-|1970-01-01T08:00:00.005+08:00|root.test.sg2|        1|        2|
-|1970-01-01T08:00:00.009+08:00|root.test.sg2|        2|        2|
-+-----------------------------+-------------+---------+---------+
-```
\ No newline at end of file
+> 6. Not support the value filter, which stands the same with the `GROUP BY LEVEL` query.
\ No newline at end of file
diff --git a/docs/UserGuide/Query-Data/Having-Condition.md b/docs/UserGuide/Query-Data/Having-Condition.md
new file mode 100644
index 0000000000..830898a4ff
--- /dev/null
+++ b/docs/UserGuide/Query-Data/Having-Condition.md
@@ -0,0 +1,115 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+        http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+
+# Aggregate Result Filtering
+
+If you want to filter the results of aggregate queries, 
+you can use the `HAVING` clause after the `GROUP BY` clause.
+
+> NOTE:
+>
+> 1.The expression in HAVING clause must consist of aggregate values; the original sequence cannot appear alone.
+> The following usages are incorrect:
+> ```sql
+> select count(s1) from root.** group by ([1,3),1ms) having sum(s1) > s1
+> select count(s1) from root.** group by ([1,3),1ms) having s1 > 1
+> ```
+> 2.When filtering the `GROUP BY LEVEL` result, the PATH in `SELECT` and `HAVING` can only have one node.
+> The following usages are incorrect:
+> ```sql
+> select count(s1) from root.** group by ([1,3),1ms), level=1 having sum(d1.s1) > 1
+> select count(d1.s1) from root.** group by ([1,3),1ms), level=1 having sum(s1) > 1
+> ```
+
+Here are a few examples of using the 'HAVING' clause to filter aggregate results.
+
+Aggregation result 1:
+
+```
++-----------------------------+---------------------+---------------------+
+|                         Time|count(root.test.*.s1)|count(root.test.*.s2)|
++-----------------------------+---------------------+---------------------+
+|1970-01-01T08:00:00.001+08:00|                    4|                    4|
+|1970-01-01T08:00:00.003+08:00|                    1|                    0|
+|1970-01-01T08:00:00.005+08:00|                    2|                    4|
+|1970-01-01T08:00:00.007+08:00|                    3|                    2|
+|1970-01-01T08:00:00.009+08:00|                    4|                    4|
++-----------------------------+---------------------+---------------------+
+```
+
+Aggregation result filtering query 1:
+
+```sql
+ select count(s1) from root.** group by ([1,11),2ms), level=1 having count(s2) > 1
+```
+
+Filtering result 1:
+
+```
++-----------------------------+---------------------+
+|                         Time|count(root.test.*.s1)|
++-----------------------------+---------------------+
+|1970-01-01T08:00:00.001+08:00|                    4|
+|1970-01-01T08:00:00.005+08:00|                    2|
+|1970-01-01T08:00:00.009+08:00|                    4|
++-----------------------------+---------------------+
+```
+
+Aggregation result 2:
+
+```
++-----------------------------+-------------+---------+---------+
+|                         Time|       Device|count(s1)|count(s2)|
++-----------------------------+-------------+---------+---------+
+|1970-01-01T08:00:00.001+08:00|root.test.sg1|        1|        2|
+|1970-01-01T08:00:00.003+08:00|root.test.sg1|        1|        0|
+|1970-01-01T08:00:00.005+08:00|root.test.sg1|        1|        2|
+|1970-01-01T08:00:00.007+08:00|root.test.sg1|        2|        1|
+|1970-01-01T08:00:00.009+08:00|root.test.sg1|        2|        2|
+|1970-01-01T08:00:00.001+08:00|root.test.sg2|        2|        2|
+|1970-01-01T08:00:00.003+08:00|root.test.sg2|        0|        0|
+|1970-01-01T08:00:00.005+08:00|root.test.sg2|        1|        2|
+|1970-01-01T08:00:00.007+08:00|root.test.sg2|        1|        1|
+|1970-01-01T08:00:00.009+08:00|root.test.sg2|        2|        2|
++-----------------------------+-------------+---------+---------+
+```
+
+Aggregation result filtering query 2:
+
+```sql
+ select count(s1), count(s2) from root.** group by ([1,11),2ms) having count(s2) > 1 align by device
+```
+
+Filtering result 2:
+
+```
++-----------------------------+-------------+---------+---------+
+|                         Time|       Device|count(s1)|count(s2)|
++-----------------------------+-------------+---------+---------+
+|1970-01-01T08:00:00.001+08:00|root.test.sg1|        1|        2|
+|1970-01-01T08:00:00.005+08:00|root.test.sg1|        1|        2|
+|1970-01-01T08:00:00.009+08:00|root.test.sg1|        2|        2|
+|1970-01-01T08:00:00.001+08:00|root.test.sg2|        2|        2|
+|1970-01-01T08:00:00.005+08:00|root.test.sg2|        1|        2|
+|1970-01-01T08:00:00.009+08:00|root.test.sg2|        2|        2|
++-----------------------------+-------------+---------+---------+
+```
\ No newline at end of file
diff --git a/docs/UserGuide/UDF-Library/M4.md b/docs/UserGuide/Query-Data/Order-By.md
similarity index 84%
rename from docs/UserGuide/UDF-Library/M4.md
rename to docs/UserGuide/Query-Data/Order-By.md
index 8c9810d022..ecac0ef18a 100644
--- a/docs/UserGuide/UDF-Library/M4.md
+++ b/docs/UserGuide/Query-Data/Order-By.md
@@ -19,9 +19,6 @@
 
 -->
 
+# Order By
 
-# M4
-
-## M4
-
-The documentation of M4 has been moved to [Query Data->Select Expression->Time Series Generating Functions](../Query-Data/Select-Expression.md).
+TODO @yang caiyin
\ No newline at end of file
diff --git a/docs/UserGuide/Query-Data/Overview.md b/docs/UserGuide/Query-Data/Overview.md
index 82e697770d..99904aed45 100644
--- a/docs/UserGuide/Query-Data/Overview.md
+++ b/docs/UserGuide/Query-Data/Overview.md
@@ -43,14 +43,74 @@ SELECT [LAST] selectExpr [, selectExpr] ...
     [ALIGN BY {TIME | DEVICE}]
 ```
 
-The most commonly used clauses of `SELECT` statements are these:
-
-- Each `resultColumn` indicates a column that you want to retrieve, which may be a suffix of time series paths, an aggregate function and so on. There must be at least one `resultColumn`.  For more details for `resultColumn`, please refer to [Select Expression](./Select-Expression.md) .
-- `fromClause` contains the prefix of one or more time-series paths to query.
-- `whereCondition` is a logical expression that returns the data points which calculation result is TRUE. If you do not specify `whereCondition`, return all data points in the time series. For more details, please refer to [Query Filter](./Query-Filter.md).
-- The query results are sorted in ascending order by timestamp. You can specify the results to be sorted in descending order by timestamp through `ORDER BY TIME DESC` clause.
-- When there is a large amount of query result data, you can use `LIMIT/SLIMIT` and `OFFSET/SOFFSET` to paginate the result set, see [Query Result Pagination](./Pagination.md) for details.
-- The query result set is aligned according to the timestamp by default, that is, the time series is used as the column, and the timestamp of each row of data is the same. For other result set alignments, see [Query Result Alignment](./Result-Format.md).
+## Syntax Description
+
+### `SELECT` clause
+
+- The `SELECT` clause specifies the output of the query, consisting of several `selectExpr`.
+- Each `selectExpr` defines one or more columns in the query result, which is an expression consisting of time series path suffixes, constants, functions, and operators.
+- Supports using `AS` to specify aliases for columns in the query result set.
+- Use the `LAST` keyword in the `SELECT` clause to specify that the query is the last query. For details and examples, see the document [Last Query](./Last-Query.md).
+- For details and examples, see the document [Select Expression](./Select-Expression.md).
+
+### `INTO` clause
+
+- `SELECT INTO` is used to write query results into a series of specified time series. The `INTO` clause specifies the target time series to which query results are written.
+- For detailed instructions and examples, see the document [SELECT INTO](Select-Into.md).
+
+### `FROM` clause
+
+- The `FROM` clause contains the path prefix of one or more time series to be queried, and wildcards are supported.
+- When executing a query, the path prefix in the `FROM` clause and the suffix in the `SELECT` clause will be concatenated to obtain a complete query target time series.
+
+### `WHERE` clause
+
+- The `WHERE` clause specifies the filtering conditions for data rows, consisting of a `whereCondition`.
+- `whereCondition` is a logical expression that evaluates to true for each row to be selected. If there is no `WHERE` clause, all rows will be selected.
+- In `whereCondition`, any IOTDB-supported functions and operators can be used except aggregate functions.
+- For details and examples, see the document [Where Condition](./Where-Condition.md).
+
+### `GROUP BY` clause
+
+- The `GROUP BY` clause specifies how the time series are aggregated by segment or group.
+- Segmented aggregation refers to segmenting data in the row direction according to the time dimension, aiming at the time relationship between different data points in the same time series, and obtaining an aggregated value for each segment. Currently only **segmentation by time interval** is supported, and more segmentation methods will be supported in the future.
+- Group aggregation refers to grouping the potential business attributes of time series for different time series. Each group contains several time series, and each group gets an aggregated value. Support **group by path level** and **group by tag** two grouping methods.
+- Segment aggregation and group aggregation can be mixed.
+- For details and examples, see the document [Group By Aggregation](./Group-By.md).
+
+### `HAVING` clause
+
+- The `HAVING` clause specifies the filter conditions for the aggregation results, consisting of a `havingCondition`.
+- `havingCondition` is a logical expression that evaluates to true for the aggregation results to be selected. If there is no `HAVING` clause, all aggregated results will be selected.
+- `HAVING` is to be used with aggregate functions and the `GROUP BY` clause.
+- For details and examples, see the document [Aggregation Result Filtering](./Having-Condition.md).
+
+### `ORDER BY` clause
+
+- The `ORDER BY` clause is used to specify how the result set is sorted.
+- In ALIGN BY TIME mode: By default, they are sorted in ascending order of timestamp size, and `ORDER BY TIME DESC` can be used to specify that the result set is sorted in descending order of timestamp.
+- In ALIGN BY DEVICE mode: arrange according to the device first, and sort each device in ascending order according to the timestamp. The `ORDER BY` clause is not supported now.
+
+### `FILL` clause
+
+- The `FILL` clause is used to specify the filling mode in the case of missing data, allowing users to fill in empty values ​​for the result set of any query according to a specific method.
+- For details and examples, see the document [Fill Null Value](./Fill.md).
+
+### `SLIMIT` and `SOFFSET` clauses
+
+- `SLIMIT` specifies the number of columns of the query result, and `SOFFSET` specifies the starting column position of the query result display. `SLIMIT` and `SOFFSET` are only used to control value columns and have no effect on time and device columns.
+- For details and examples of query result pagination, see the document [Result Set Pagination](./Pagination.md).
+
+### `LIMIT` and `OFFSET` clauses
+
+- `LIMIT` specifies the number of rows of the query result, and `OFFSET` specifies the starting row position of the query result display.
+- For details and examples of query result pagination, see the document [Result Set Pagination](./Pagination.md).
+
+### `ALIGN BY` clause
+
+- The query result set is **ALIGN BY TIME** by default, including a time column and several value columns, and the timestamps of each column of data in each row are the same.
+- It also supports  **ALIGN BY DEVICE**. The query result set contains a time column, a device column, and several value columns.
+- For details and examples, see the document [Query Alignment Mode](./Align-By.md).
 
 ## Basic Examples
 
diff --git a/docs/UserGuide/Query-Data/Pagination.md b/docs/UserGuide/Query-Data/Pagination.md
index c993888464..42ea36f621 100644
--- a/docs/UserGuide/Query-Data/Pagination.md
+++ b/docs/UserGuide/Query-Data/Pagination.md
@@ -19,7 +19,7 @@
 
 -->
 
-# Pagination with LIMIT & OFFSET
+# Pagination
 
 When the query result set has a large amount of data, it is not conducive to display on one page. You can use the `LIMIT/SLIMIT` clause and the `OFFSET/SOFFSET` clause to control paging.
 
diff --git a/docs/UserGuide/Query-Data/Performance-Tracing-Tool.md b/docs/UserGuide/Query-Data/Performance-Tracing-Tool.md
deleted file mode 100644
index c2573059d7..0000000000
--- a/docs/UserGuide/Query-Data/Performance-Tracing-Tool.md
+++ /dev/null
@@ -1,53 +0,0 @@
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-    
-        http://www.apache.org/licenses/LICENSE-2.0
-    
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
--->
-## Performance Tracing Tool
-
-> Note: TRACING ON/OFF hasn't been supported yet.
-
-IoTDB supports the use of the `TRACING` clause to enable performance tracing of executed statements. Users can use the performance tracing tool to analyze potential performance problems in some statements.
-
-Traceable statement: `SELECT` only.
-
-The current performance analysis includes the following contents:
-1. The elapsed time of each stage of the execution process.
-2. Statistics related to performance analysis. For query statements, it includes the number of time series queried, the number of Tsfile files accessed, the total number of chunks to be scanned, and the average number of data points contained in the chunk, the total number of pages read, and the number of overlapped pages.
-
-### Example
-
-For example, execute `tracing select * from root`, will display the following contents:
-
-```
-Tracing Activties:
-+------------------------------------------------------+------------+
-|                                              Activity|Elapsed Time|
-+------------------------------------------------------+------------+
-|Start to execute statement: tracing select * from root|           0|
-|                            Parse SQL to physical plan|           4|
-|                              Create and cache dataset|          16|
-|                              * Num of series paths: 3|            |
-|                       * Num of sequence files read: 2|            |
-|                     * Num of unsequence files read: 1|            |
-|        * Num of sequence chunks: 6, avg points: 100.0|            |
-|      * Num of unsequence chunks: 3, avg points: 100.0|            |
-|         * Num of Pages: 9, overlapped pages: 0 (0.0%)|            |
-|                                      Request complete|          20|
-+------------------------------------------------------+------------+
-```
\ No newline at end of file
diff --git a/docs/UserGuide/Query-Data/Select-Expression.md b/docs/UserGuide/Query-Data/Select-Expression.md
index 2f32013928..bcfd32dff8 100644
--- a/docs/UserGuide/Query-Data/Select-Expression.md
+++ b/docs/UserGuide/Query-Data/Select-Expression.md
@@ -21,1046 +21,71 @@
 
 # Select Expression
 
-## Syntax Definition
-
-A selection expression (`selectExpr`) is a component of a SELECT clause, each `selectExpr` corresponds to a column in the query result set, and its syntax is defined as follows:
-
-```sql
-selectClause
-: SELECT resultColumn (',' resultColumn)*
-;
-
-resultColumn
-: selectExpr (AS alias)?
-    ;
-
-selectExpr
-: '(' selectExpr ')'
-    | '-' selectExpr
-    | '!' selectExpr
-    | selectExpr ('*' | '/' | '%') selectExpr
-    | selectExpr ('+' | '-') selectExpr
-    | selectExpr ('>' | '>=' | '<' | '<=' | '==' | '!=') selectExpr
-    | selectExpr (AND | OR) selectExpr
-    | functionName '(' selectExpr (',' selectExpr)* functionAttribute* ')'
-    | timeSeriesSuffixPath
-    | number
-    ;
-```
-
-From this syntax definition, `selectExpr` can contain:
-
-- suffix of time series path 
+The `SELECT` clause specifies the output of the query, consisting of several `selectExpr`. Each `selectExpr` defines one or more columns in the query result.
+
+**`selectExpr` is an expression consisting of time series path suffixes, constants, functions, and operators. That is, `selectExpr` can contain: **
+- Time series path suffix (wildcards are supported)
+- operator
+   - Arithmetic operators
+   - comparison operators
+   - Logical Operators
 - function
-   - Built-in aggregation functions, see [Aggregate Query](./Aggregate-Query.md) for details.
-   - Time series generation function
-   - User-defined functions, see [UDF](../Process-Data/UDF-User-Defined-Function.md) for details.
-- expressions
-   - Arithmetic operation expressions
-   - Time series generating nested expressions
-   - Aggregate query nested expressions
-- Numeric constants (could be used in expressions only)
-
-## Arithmetic Query
-
-### Operators
-
-#### Unary Arithmetic Operators
-
-Supported operators: `+`, `-`
-
-Supported input data types: `INT32`, `INT64` and `FLOAT`
-
-Output data type: consistent with the input data type
-
-#### Binary Arithmetic Operators
-
-Supported operators: `+`, `-`, `*`, `/`, `%`
-
-Supported input data types: `INT32`, `INT64`, `FLOAT` and `DOUBLE`
-
-Output data type: `DOUBLE`
-
-Note: Only when the left operand and the right operand under a certain timestamp are not  `null`, the binary arithmetic operation will have an output value.
-
-### Example
-
-```sql
-select s1, - s1, s2, + s2, s1 + s2, s1 - s2, s1 * s2, s1 / s2, s1 % s2 from root.sg.d1
-```
-
-Result:
-
-```
-+-----------------------------+-------------+--------------+-------------+-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+
-|                         Time|root.sg.d1.s1|-root.sg.d1.s1|root.sg.d1.s2|root.sg.d1.s2|root.sg.d1.s1 + root.sg.d1.s2|root.sg.d1.s1 - root.sg.d1.s2|root.sg.d1.s1 * root.sg.d1.s2|root.sg.d1.s1 / root.sg.d1.s2|root.sg.d1.s1 % root.sg.d1.s2|
-+-----------------------------+-------------+--------------+-------------+-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+
-|1970-01-01T08:00:00.001+08:00|          1.0|          -1.0|          1.0|          1.0|                          2.0|                          0.0|                          1.0|                          1.0|                          0.0|
-|1970-01-01T08:00:00.002+08:00|          2.0|          -2.0|          2.0|          2.0|                          4.0|                          0.0|                          4.0|                          1.0|                          0.0|
-|1970-01-01T08:00:00.003+08:00|          3.0|          -3.0|          3.0|          3.0|                          6.0|                          0.0|                          9.0|                          1.0|                          0.0|
-|1970-01-01T08:00:00.004+08:00|          4.0|          -4.0|          4.0|          4.0|                          8.0|                          0.0|                         16.0|                          1.0|                          0.0|
-|1970-01-01T08:00:00.005+08:00|          5.0|          -5.0|          5.0|          5.0|                         10.0|                          0.0|                         25.0|                          1.0|                          0.0|
-+-----------------------------+-------------+--------------+-------------+-------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+-----------------------------+
-Total line number = 5
-It costs 0.014s
-```
-
-## Compare Expression
-### Operators
-#### Unary Logical Operators
-Supported operator `!`
-
-Supported input data types: `BOOLEAN`
-
-Output data type: `BOOLEAN`
-
-Hint: the priority of `!` is the same as `-`. Remember to use brackets to modify priority.
-
-#### Binary Compare Operators
-
-Supported operators `>`, `>=`, `<`, `<=`, `==`, `!=`
-
-Supported input data types: `INT32`, `INT64`, `FLOAT` and `DOUBLE` 
-
-Note: It will transform all type to `DOUBLE` then do computation. 
-
-Output data type: `BOOLEAN`
-
-#### Binary Logical Operators
-
-Supported operators AND:`and`,`&`, `&&`; OR:`or`,`|`,`||`
-
-Supported input data types: `BOOLEAN`
-
-Output data type: `BOOLEAN`
-
-Note: Only when the left operand and the right operand under a certain timestamp are both `BOOLEAN` type, the binary logic operation will have an output value.
-
-#### IN Operators
-
-Supported operator `IN`
-
-Supported input data types: `All Types`
-
-Output data type: `BOOLEAN`
-
-Note: Please ensure the value strings in set can be cast to the DataType of Operand
-> Example: 
-> 
->`s1 in (1, 2, 3, 'test')`, DataType of `s1` is `INT32`
-> 
-> We will throw Exception because `'test'` cannot be cast to `INT32`
-
-#### String Match Operators
-
-Supported operators `LIKE`, `REGEXP`
-
-Supported input data types: `TEXT`
-
-Output data type: `BOOLEAN`
-
-### Example
-
-Input1:
-```sql
-select a, b, a > 10, a <= b, !(a <= b), a > 10 && a > b from root.test;
-```
-
-Output1:
-```
-+-----------------------------+-----------+-----------+----------------+--------------------------+---------------------------+------------------------------------------------+
-|                         Time|root.test.a|root.test.b|root.test.a > 10|root.test.a <= root.test.b|!root.test.a <= root.test.b|(root.test.a > 10) & (root.test.a > root.test.b)|
-+-----------------------------+-----------+-----------+----------------+--------------------------+---------------------------+------------------------------------------------+
-|1970-01-01T08:00:00.001+08:00|         23|       10.0|            true|                     false|                       true|                                            true|
-|1970-01-01T08:00:00.002+08:00|         33|       21.0|            true|                     false|                       true|                                            true|
-|1970-01-01T08:00:00.004+08:00|         13|       15.0|            true|                      true|                      false|                                           false|
-|1970-01-01T08:00:00.005+08:00|         26|        0.0|            true|                     false|                       true|                                            true|
-|1970-01-01T08:00:00.008+08:00|          1|       22.0|           false|                      true|                      false|                                           false|
-|1970-01-01T08:00:00.010+08:00|         23|       12.0|            true|                     false|                       true|                                            true|
-+-----------------------------+-----------+-----------+----------------+--------------------------+---------------------------+------------------------------------------------+
-```
-
-Input2:
-```sql
-select a, b, a in (1, 2), b like '1%', b regexp '[0-2]' from root.test;
-```
-
-Output2:
-```
-+-----------------------------+-----------+-----------+--------------------+-------------------------+--------------------------+
-|                         Time|root.test.a|root.test.b|root.test.a IN (1,2)|root.test.b LIKE '^1.*?$'|root.test.b REGEXP '[0-2]'|
-+-----------------------------+-----------+-----------+--------------------+-------------------------+--------------------------+
-|1970-01-01T08:00:00.001+08:00|          1| 111test111|                true|                     true|                      true|
-|1970-01-01T08:00:00.003+08:00|          3| 333test333|               false|                    false|                     false|
-+-----------------------------+-----------+-----------+--------------------+-------------------------+--------------------------+
-```
-
-## Priority of Operators
-
-|priority|operator  |meaning            |
-|:---:|:------------|:------------------|
-|1    |`-`          |Unary operator negative  |
-|1    |`+`          |Unary operator positive  |
-|1    |`!`          |Unary operator negation  |
-|2    |`*`          |Binary operator multiply |
-|2    |`/`          |Binary operator division |
-|2    |`%`          |Binary operator remainder|
-|3    |`+`          |Binary operator add      |
-|3    |`-`          |Binary operator minus    |
-|4    |`>`          |Binary compare operator greater than|
-|4    |`>=`         |Binary compare operator greater or equal to|
-|4    |`<`          |Binary compare operator less than|
-|4    |`<=`         |Binary compare operator less or equal to|
-|4    |`==`         |Binary compare operator equal to|
-|4    |`!=`/`<>`    |Binary compare operator non-equal to|
-|5      |`REGEXP`   |`REGEXP` operator|
-|5      |`LIKE`    |`LIKE` operator|
-|6      |`IN`    |`IN` operator|
-|7    |`and`/`&`/`&&`               |Binary logic operator and|
-|8    |`or`/ &#124; / &#124;&#124;  |Binary logic operator or|
-
-## Time Series Generating Functions
-
-The time series generating function takes several time series as input and outputs one time series. Unlike the aggregation function, the result set of the time series generating function has a timestamp column.
-
-All time series generating functions can accept * as input.
-
-IoTDB supports hybrid queries of time series generating function queries and raw data queries.
-
-### Mathematical Functions
-
-Currently, IoTDB supports the following mathematical functions. The behavior of these mathematical functions is consistent with the behavior of these functions in the Java Math standard library.
-
-| Function Name | Allowed Input Series Data Types | Output Series Data Type       | Corresponding Implementation in the Java Standard Library    |
-| ------------- | ------------------------------- | ----------------------------- | ------------------------------------------------------------ |
-| SIN           | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#sin(double)                                             |
-| COS           | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#cos(double)                                             |
-| TAN           | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#tan(double)                                             |
-| ASIN          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#asin(double)                                            |
-| ACOS          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#acos(double)                                            |
-| ATAN          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#atan(double)                                            |
-| SINH          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#sinh(double)                                            |
-| COSH          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#cosh(double)                                            |
-| TANH          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#tanh(double)                                            |
-| DEGREES       | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#toDegrees(double)                                       |
-| RADIANS       | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#toRadians(double)                                       |
-| ABS           | INT32 / INT64 / FLOAT / DOUBLE  | Same type as the input series | Math#abs(int) / Math#abs(long) /Math#abs(float) /Math#abs(double) |
-| SIGN          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#signum(double)                                          |
-| CEIL          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#ceil(double)                                            |
-| FLOOR         | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#floor(double)                                           |
-| ROUND         | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#rint(double)                                            |
-| EXP           | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#exp(double)                                             |
-| LN            | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#log(double)                                             |
-| LOG10         | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#log10(double)                                           |
-| SQRT          | INT32 / INT64 / FLOAT / DOUBLE  | DOUBLE                        | Math#sqrt(double)                                            |
-
-Example:
-
-```   sql
-select s1, sin(s1), cos(s1), tan(s1) from root.sg1.d1 limit 5 offset 1000;
-```
-
-Result:
-
-```
-+-----------------------------+-------------------+-------------------+--------------------+-------------------+
-|                         Time|     root.sg1.d1.s1|sin(root.sg1.d1.s1)| cos(root.sg1.d1.s1)|tan(root.sg1.d1.s1)|
-+-----------------------------+-------------------+-------------------+--------------------+-------------------+
-|2020-12-10T17:11:49.037+08:00|7360723084922759782| 0.8133527237573284|  0.5817708713544664| 1.3980636773094157|
-|2020-12-10T17:11:49.038+08:00|4377791063319964531|-0.8938962705202537|  0.4482738644511651| -1.994085181866842|
-|2020-12-10T17:11:49.039+08:00|7972485567734642915| 0.9627757585308978|-0.27030138509681073|-3.5618602479083545|
-|2020-12-10T17:11:49.040+08:00|2508858212791964081|-0.6073417341629443| -0.7944406950452296| 0.7644897069734913|
-|2020-12-10T17:11:49.041+08:00|2817297431185141819|-0.8419358900502509| -0.5395775727782725| 1.5603611649667768|
-+-----------------------------+-------------------+-------------------+--------------------+-------------------+
-Total line number = 5
-It costs 0.008s
-```
-
-### String Processing Functions
-
-Currently, IoTDB supports the following string processing functions:
-
-| Function Name   | Allowed Input Series Data Types | Required Attributes                                          | Output Series Data Type | Description                                            |
-| --------------- | ------------------------------- | ------------------------------------------------------------ | ----------------------- | ------------------------------------------------------ |
-| STRING_CONTAINS | TEXT                            | `s`: the sequence to search for                              | BOOLEAN                 | Determine whether `s` is in the string                 |
-| STRING_MATCHES  | TEXT                            | `regex`: the regular expression to which the string is to be matched | BOOLEAN                 | Determine whether the string can be matched by `regex` |
-
-Example:
-
-```   sql
-select s1, string_contains(s1, 's'='warn'), string_matches(s1, 'regex'='[^\\s]+37229') from root.sg1.d4;
-```
-
-Result:
-
-``` 
-+-----------------------------+--------------+-------------------------------------------+------------------------------------------------------+
-|                         Time|root.sg1.d4.s1|string_contains(root.sg1.d4.s1, "s"="warn")|string_matches(root.sg1.d4.s1, "regex"="[^\\s]+37229")|
-+-----------------------------+--------------+-------------------------------------------+------------------------------------------------------+
-|1970-01-01T08:00:00.001+08:00|    warn:-8721|                                       true|                                                 false|
-|1970-01-01T08:00:00.002+08:00|  error:-37229|                                      false|                                                  true|
-|1970-01-01T08:00:00.003+08:00|     warn:1731|                                       true|                                                 false|
-+-----------------------------+--------------+-------------------------------------------+------------------------------------------------------+
-Total line number = 3
-It costs 0.007s
-```
-
-### Selector Functions
-
-Currently, IoTDB supports the following selector functions:
-
-| Function Name | Allowed Input Series Data Types       | Required Attributes                                          | Output Series Data Type       | Description                                                  |
-| ------------- | ------------------------------------- | ------------------------------------------------------------ | ----------------------------- | ------------------------------------------------------------ |
-| TOP_K         | INT32 / INT64 / FLOAT / DOUBLE / TEXT | `k`: the maximum number of selected data points, must be greater than 0 and less than or equal to 1000 | Same type as the input series | Returns `k` data points with the largest values in a time series. |
-| BOTTOM_K      | INT32 / INT64 / FLOAT / DOUBLE / TEXT | `k`: the maximum number of selected data points, must be greater than 0 and less than or equal to 1000 | Same type as the input series | Returns `k` data points with the smallest values in a time series. |
-
-Example:
-
-```   sql
-select s1, top_k(s1, 'k'='2'), bottom_k(s1, 'k'='2') from root.sg1.d2 where time > 2020-12-10T20:36:15.530+08:00;
-```
-
-Result:
-
-``` 
-+-----------------------------+--------------------+------------------------------+---------------------------------+
-|                         Time|      root.sg1.d2.s1|top_k(root.sg1.d2.s1, "k"="2")|bottom_k(root.sg1.d2.s1, "k"="2")|
-+-----------------------------+--------------------+------------------------------+---------------------------------+
-|2020-12-10T20:36:15.531+08:00| 1531604122307244742|           1531604122307244742|                             null|
-|2020-12-10T20:36:15.532+08:00|-7426070874923281101|                          null|                             null|
-|2020-12-10T20:36:15.533+08:00|-7162825364312197604|          -7162825364312197604|                             null|
-|2020-12-10T20:36:15.534+08:00|-8581625725655917595|                          null|             -8581625725655917595|
-|2020-12-10T20:36:15.535+08:00|-7667364751255535391|                          null|             -7667364751255535391|
-+-----------------------------+--------------------+------------------------------+---------------------------------+
-Total line number = 5
-It costs 0.006s
-```
-
-### Variation Trend Calculation Functions
-
-Currently, IoTDB supports the following variation trend calculation functions:
-
-| Function Name           | Allowed Input Series Data Types                 | Output Series Data Type       | Description                                                  |
-| ----------------------- | ----------------------------------------------- | ----------------------------- | ------------------------------------------------------------ |
-| TIME_DIFFERENCE         | INT32 / INT64 / FLOAT / DOUBLE / BOOLEAN / TEXT | INT64                         | Calculates the difference between the time stamp of a data point and the time stamp of the previous data point. There is no corresponding output for the first data point. |
-| DIFFERENCE              | INT32 / INT64 / FLOAT / DOUBLE                  | Same type as the input series | Calculates the difference between the value of a data point and the value of the previous data point. There is no corresponding output for the first data point. |
-| NON_NEGATIVE_DIFFERENCE | INT32 / INT64 / FLOAT / DOUBLE                  | Same type as the input series | Calculates the absolute value of the difference between the value of a data point and the value of the previous data point. There is no corresponding output for the first data point. |
-| DERIVATIVE              | INT32 / INT64 / FLOAT / DOUBLE                  | DOUBLE                        | Calculates the rate of change of a data point compared to the previous data point, the result is equals to DIFFERENCE / TIME_DIFFERENCE. There is no corresponding output for the first data point. |
-| NON_NEGATIVE_DERIVATIVE | INT32 / INT64 / FLOAT / DOUBLE                  | DOUBLE                        | Calculates the absolute value of the rate of change of a data point compared to the previous data point, the result is equals to NON_NEGATIVE_DIFFERENCE / TIME_DIFFERENCE. There is no corresponding output for the first data point. |
-
-Example:
-
-```   sql
-select s1, time_difference(s1), difference(s1), non_negative_difference(s1), derivative(s1), non_negative_derivative(s1) from root.sg1.d1 limit 5 offset 1000; 
-```
-
-Result:
-
-``` 
-+-----------------------------+-------------------+-------------------------------+--------------------------+---------------------------------------+--------------------------+---------------------------------------+
-|                         Time|     root.sg1.d1.s1|time_difference(root.sg1.d1.s1)|difference(root.sg1.d1.s1)|non_negative_difference(root.sg1.d1.s1)|derivative(root.sg1.d1.s1)|non_negative_derivative(root.sg1.d1.s1)|
-+-----------------------------+-------------------+-------------------------------+--------------------------+---------------------------------------+--------------------------+---------------------------------------+
-|2020-12-10T17:11:49.037+08:00|7360723084922759782|                              1|      -8431715764844238876|                    8431715764844238876|    -8.4317157648442388E18|                  8.4317157648442388E18|
-|2020-12-10T17:11:49.038+08:00|4377791063319964531|                              1|      -2982932021602795251|                    2982932021602795251|     -2.982932021602795E18|                   2.982932021602795E18|
-|2020-12-10T17:11:49.039+08:00|7972485567734642915|                              1|       3594694504414678384|                    3594694504414678384|     3.5946945044146785E18|                  3.5946945044146785E18|
-|2020-12-10T17:11:49.040+08:00|2508858212791964081|                              1|      -5463627354942678834|                    5463627354942678834|     -5.463627354942679E18|                   5.463627354942679E18|
-|2020-12-10T17:11:49.041+08:00|2817297431185141819|                              1|        308439218393177738|                     308439218393177738|     3.0843921839317773E17|                  3.0843921839317773E17|
-+-----------------------------+-------------------+-------------------------------+--------------------------+---------------------------------------+--------------------------+---------------------------------------+
-Total line number = 5
-It costs 0.014s
-```
-
-### Constant Timeseries Generating Functions
-
-The constant timeseries generating function is used to generate a timeseries in which the values of all data points are the same.
-
-The constant timeseries generating function accepts one or more timeseries inputs, and the timestamp set of the output data points is the union of the timestamp sets of the input timeseries.
-
-Currently, IoTDB supports the following constant timeseries generating functions:
-
-| Function Name | Required Attributes                                          | Output Series Data Type                      | Description                                                  |
-| ------------- | ------------------------------------------------------------ | -------------------------------------------- | ------------------------------------------------------------ |
-| CONST         | `value`: the value of the output data point <br />`type`: the type of the output data point, it can only be INT32 / INT64 / FLOAT / DOUBLE / BOOLEAN / TEXT | Determined by the required attribute  `type` | Output the user-specified constant timeseries according to the  attributes `value` and `type`. |
-| PI            | None                                                         | DOUBLE                                       | Data point value: a `double` value of  `π`, the ratio of the circumference of a circle to its diameter, which is equals to `Math.PI` in the *Java Standard Library*. |
-| E             | None                                                         | DOUBLE                                       | Data point value: a `double` value of  `e`, the base of the natural logarithms, which is equals to `Math.E` in the *Java Standard Library*. |
-
-Example:
-
-```   sql
-select s1, s2, const(s1, 'value'='1024', 'type'='INT64'), pi(s2), e(s1, s2) from root.sg1.d1; 
-```
-
-Result:
-
-```
-select s1, s2, const(s1, 'value'='1024', 'type'='INT64'), pi(s2), e(s1, s2) from root.sg1.d1; 
-+-----------------------------+--------------+--------------+-----------------------------------------------------+------------------+---------------------------------+
-|                         Time|root.sg1.d1.s1|root.sg1.d1.s2|const(root.sg1.d1.s1, "value"="1024", "type"="INT64")|pi(root.sg1.d1.s2)|e(root.sg1.d1.s1, root.sg1.d1.s2)|
-+-----------------------------+--------------+--------------+-----------------------------------------------------+------------------+---------------------------------+
-|1970-01-01T08:00:00.000+08:00|           0.0|           0.0|                                                 1024| 3.141592653589793|                2.718281828459045|
-|1970-01-01T08:00:00.001+08:00|           1.0|          null|                                                 1024|              null|                2.718281828459045|
-|1970-01-01T08:00:00.002+08:00|           2.0|          null|                                                 1024|              null|                2.718281828459045|
-|1970-01-01T08:00:00.003+08:00|          null|           3.0|                                                 null| 3.141592653589793|                2.718281828459045|
-|1970-01-01T08:00:00.004+08:00|          null|           4.0|                                                 null| 3.141592653589793|                2.718281828459045|
-+-----------------------------+--------------+--------------+-----------------------------------------------------+------------------+---------------------------------+
-Total line number = 5
-It costs 0.005s
-```
-### Data Type Conversion Function
-The IoTDB currently supports 6 data types, including INT32, INT64 ,FLOAT, DOUBLE, BOOLEAN, TEXT. When we query or evaluate data, we may need to convert data types, such as TEXT to INT32, or improve the accuracy of the data, such as FLOAT to DOUBLE. Therefore, IoTDB supports the use of cast functions to convert data types.
-
-| Function Name | Required Attributes                                          | Output Series Data Type                      | Series Data Type  Description                               |
-| ------------- | ------------------------------------------------------------ | -------------------------------------------- | ----------------------------------------------------------- |
-| CAST          | `type`: the type of the output data point, it can only be INT32 / INT64 / FLOAT / DOUBLE / BOOLEAN / TEXT | Determined by the required attribute  `type` | Converts data to the type specified by the `type` argument. |
-
-#### Notes
-1. The value of type BOOLEAN is `true`, when data is converted to BOOLEAN if INT32 and INT64 are not 0, FLOAT and DOUBLE are not 0.0, TEXT is not empty string or "false", otherwise `false`.    
-
-```
-IoTDB> show timeseries root.sg.d1.*;
-+-------------+-----+-------------+--------+--------+-----------+----+----------+
-|   timeseries|alias|     database|dataType|encoding|compression|tags|attributes|
-+-------------+-----+-------------+--------+--------+-----------+----+----------+
-|root.sg.d1.s3| null|      root.sg|   FLOAT|     RLE|     SNAPPY|null|      null|
-|root.sg.d1.s4| null|      root.sg|  DOUBLE|     RLE|     SNAPPY|null|      null|
-|root.sg.d1.s5| null|      root.sg|    TEXT|   PLAIN|     SNAPPY|null|      null|
-|root.sg.d1.s6| null|      root.sg| BOOLEAN|     RLE|     SNAPPY|null|      null|
-|root.sg.d1.s1| null|      root.sg|   INT32|     RLE|     SNAPPY|null|      null|
-|root.sg.d1.s2| null|      root.sg|   INT64|     RLE|     SNAPPY|null|      null|
-+-------------+-----+-------------+--------+--------+-----------+----+----------+
-Total line number = 6
-It costs 0.006s
-IoTDB> select * from root.sg.d1;
-+-----------------------------+-------------+-------------+-------------+-------------+-------------+-------------+
-|                         Time|root.sg.d1.s3|root.sg.d1.s4|root.sg.d1.s5|root.sg.d1.s6|root.sg.d1.s1|root.sg.d1.s2|
-+-----------------------------+-------------+-------------+-------------+-------------+-------------+-------------+
-|1970-01-01T08:00:00.001+08:00|          1.1|          1.1|         test|        false|            1|            1|
-|1970-01-01T08:00:00.002+08:00|         -2.2|         -2.2|        false|         true|           -2|           -2|
-|1970-01-01T08:00:00.003+08:00|          0.0|          0.0|         true|         true|            0|            0|
-+-----------------------------+-------------+-------------+-------------+-------------+-------------+-------------+
-Total line number = 3
-It costs 0.009s
-IoTDB> select cast(s1, 'type'='BOOLEAN'), cast(s2, 'type'='BOOLEAN'), cast(s3, 'type'='BOOLEAN'), cast(s4, 'type'='BOOLEAN'), cast(s5, 'type'='BOOLEAN') from root.sg.d1;
-+-----------------------------+-------------------------------------+-------------------------------------+-------------------------------------+-------------------------------------+-------------------------------------+
-|                         Time|cast(root.sg.d1.s1, "type"="BOOLEAN")|cast(root.sg.d1.s2, "type"="BOOLEAN")|cast(root.sg.d1.s3, "type"="BOOLEAN")|cast(root.sg.d1.s4, "type"="BOOLEAN")|cast(root.sg.d1.s5, "type"="BOOLEAN")|
-+-----------------------------+-------------------------------------+-------------------------------------+-------------------------------------+-------------------------------------+-------------------------------------+
-|1970-01-01T08:00:00.001+08:00|                                 true|                                 true|                                 true|                                 true|                                 true|
-|1970-01-01T08:00:00.002+08:00|                                 true|                                 true|                                 true|                                 true|                                false|
-|1970-01-01T08:00:00.003+08:00|                                false|                                false|                                false|                                false|                                 true|
-+-----------------------------+-------------------------------------+-------------------------------------+-------------------------------------+-------------------------------------+-------------------------------------+
-Total line number = 3
-It costs 0.012s
-```
-
-2. The value of type INT32, INT64, FLOAT, DOUBLE are 1 or 1.0 and TEXT is "true", when BOOLEAN data is true, otherwise 0, 0.0 or "false".  
-
-```
-IoTDB> select cast(s6, 'type'='INT32'), cast(s6, 'type'='INT64'), cast(s6, 'type'='FLOAT'), cast(s6, 'type'='DOUBLE'), cast(s6, 'type'='TEXT') from root.sg.d1;
-+-----------------------------+-----------------------------------+-----------------------------------+-----------------------------------+------------------------------------+----------------------------------+
-|                         Time|cast(root.sg.d1.s6, "type"="INT32")|cast(root.sg.d1.s6, "type"="INT64")|cast(root.sg.d1.s6, "type"="FLOAT")|cast(root.sg.d1.s6, "type"="DOUBLE")|cast(root.sg.d1.s6, "type"="TEXT")|
-+-----------------------------+-----------------------------------+-----------------------------------+-----------------------------------+------------------------------------+----------------------------------+
-|1970-01-01T08:00:00.001+08:00|                                  0|                                  0|                                0.0|                                 0.0|                             false|
-|1970-01-01T08:00:00.002+08:00|                                  1|                                  1|                                1.0|                                 1.0|                              true|
-|1970-01-01T08:00:00.003+08:00|                                  1|                                  1|                                1.0|                                 1.0|                              true|
-+-----------------------------+-----------------------------------+-----------------------------------+-----------------------------------+------------------------------------+----------------------------------+
-Total line number = 3
-It costs 0.016s
-```
-
-3. When TEXT is converted to INT32, INT64, or FLOAT, the TEXT is first converted to DOUBLE and then to the corresponding type, which may cause loss of precision. It will skip directly if the data can not be converted.
-
-```
-IoTDB> select cast(s5, 'type'='INT32'), cast(s5, 'type'='INT64'), cast(s5, 'type'='FLOAT') from root.sg.d1;
-+----+-----------------------------------+-----------------------------------+-----------------------------------+
-|Time|cast(root.sg.d1.s5, "type"="INT32")|cast(root.sg.d1.s5, "type"="INT64")|cast(root.sg.d1.s5, "type"="FLOAT")|
-+----+-----------------------------------+-----------------------------------+-----------------------------------+
-+----+-----------------------------------+-----------------------------------+-----------------------------------+
-Empty set.
-It costs 0.005s
-```
-
-
-
-#### Syntax
-Example data:
-```
-IoTDB> select text from root.test;
-+-----------------------------+--------------+
-|                         Time|root.test.text|
-+-----------------------------+--------------+
-|1970-01-01T08:00:00.001+08:00|           1.1|
-|1970-01-01T08:00:00.002+08:00|             1|
-|1970-01-01T08:00:00.003+08:00|   hello world|
-|1970-01-01T08:00:00.004+08:00|         false|
-+-----------------------------+--------------+
-```
-SQL:
-```sql
-select cast(text, 'type'='BOOLEAN'), cast(text, 'type'='INT32'), cast(text, 'type'='INT64'), cast(text, 'type'='FLOAT'), cast(text, 'type'='DOUBLE') from root.test;
-```
-Result:
-```
-+-----------------------------+--------------------------------------+------------------------------------+------------------------------------+------------------------------------+-------------------------------------+
-|                         Time|cast(root.test.text, "type"="BOOLEAN")|cast(root.test.text, "type"="INT32")|cast(root.test.text, "type"="INT64")|cast(root.test.text, "type"="FLOAT")|cast(root.test.text, "type"="DOUBLE")|
-+-----------------------------+--------------------------------------+------------------------------------+------------------------------------+------------------------------------+-------------------------------------+
-|1970-01-01T08:00:00.001+08:00|                                  true|                                   1|                                   1|                                 1.1|                                  1.1|
-|1970-01-01T08:00:00.002+08:00|                                  true|                                   1|                                   1|                                 1.0|                                  1.0|
-|1970-01-01T08:00:00.003+08:00|                                  true|                                null|                                null|                                null|                                 null|
-|1970-01-01T08:00:00.004+08:00|                                 false|                                null|                                null|                                null|                                 null|
-+-----------------------------+--------------------------------------+------------------------------------+------------------------------------+------------------------------------+-------------------------------------+
-Total line number = 4
-It costs 0.078s
-```
-
-### Condition Functions
-Condition functions are used to check whether timeseries data points satisfy some specific condition. 
-
-They return BOOLEANs.
-
-Currently, IoTDB supports the following condition functions:
-
-| Function Name | Allowed Input Series Data Types | Required Attributes                           | Output Series Data Type | Series Data Type  Description                 |
-|---------------|---------------------------------|-----------------------------------------------|-------------------------|-----------------------------------------------|
-| ON_OFF        | INT32 / INT64 / FLOAT / DOUBLE  | `threshold`: a double type variate            | BOOLEAN                 | Return `ts_value >= threshold`.               |
-| IN_RANGR      | INT32 / INT64 / FLOAT / DOUBLE  | `lower`: DOUBLE type<br/>`upper`: DOUBLE type | BOOLEAN                 | Return `ts_value >= lower && value <= upper`. |
-
-Example Data:
-```
-IoTDB> select ts from root.test;
-+-----------------------------+------------+
-|                         Time|root.test.ts|
-+-----------------------------+------------+
-|1970-01-01T08:00:00.001+08:00|           1|
-|1970-01-01T08:00:00.002+08:00|           2|
-|1970-01-01T08:00:00.003+08:00|           3|
-|1970-01-01T08:00:00.004+08:00|           4|
-+-----------------------------+------------+
-```
-
-##### Test 1
-SQL:
-```sql
-select ts, on_off(ts, 'threshold'='2') from root.test;
-```
-
-Output:
-```
-IoTDB> select ts, on_off(ts, 'threshold'='2') from root.test;
-+-----------------------------+------------+-------------------------------------+
-|                         Time|root.test.ts|on_off(root.test.ts, "threshold"="2")|
-+-----------------------------+------------+-------------------------------------+
-|1970-01-01T08:00:00.001+08:00|           1|                                false|
-|1970-01-01T08:00:00.002+08:00|           2|                                 true|
-|1970-01-01T08:00:00.003+08:00|           3|                                 true|
-|1970-01-01T08:00:00.004+08:00|           4|                                 true|
-+-----------------------------+------------+-------------------------------------+
-```
-
-##### Test 2
-Sql:
-```sql
-select ts, in_range(ts, 'lower'='2', 'upper'='3.1') from root.test;
-```
-
-Output:
-```
-IoTDB> select ts, in_range(ts,'lower'='2', 'upper'='3.1') from root.test;
-+-----------------------------+------------+--------------------------------------------------+
-|                         Time|root.test.ts|in_range(root.test.ts, "lower"="2", "upper"="3.1")|
-+-----------------------------+------------+--------------------------------------------------+
-|1970-01-01T08:00:00.001+08:00|           1|                                             false|
-|1970-01-01T08:00:00.002+08:00|           2|                                              true|
-|1970-01-01T08:00:00.003+08:00|           3|                                              true|
-|1970-01-01T08:00:00.004+08:00|           4|                                             false|
-+-----------------------------+------------+--------------------------------------------------+
-```
-
-### Continuous Interval Functions
-The continuous interval functions are used to query all continuous intervals that meet specified conditions.
-They can be divided into two categories according to return value:
-1. Returns the start timestamp and time span of the continuous interval that meets the conditions (a time span of 0 means that only the start time point meets the conditions)
-2. Returns the start timestamp of the continuous interval that meets the condition and the number of points in the interval (a number of 1 means that only the start time point meets the conditions)
-
-| Function Name     | Input TSDatatype                     | Parameters                                                                                    | Output TSDatatype | Function Description                                                                                                                                                         |
-|-------------------|--------------------------------------|-----------------------------------------------------------------------------------------------|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| ZERO_DURATION     | INT32/ INT64/ FLOAT/ DOUBLE/ BOOLEAN | `min`:Optional with default value `0L`</br>`max`:Optional with default value `Long.MAX_VALUE` | Long              | Return intervals' start times and duration times in which the value is always 0(false), and the duration time `t` satisfy `t >= min && t <= max`. The unit of `t` is ms      |
-| NON_ZERO_DURATION | INT32/ INT64/ FLOAT/ DOUBLE/ BOOLEAN | `min`:Optional with default value `0L`</br>`max`:Optional with default value `Long.MAX_VALUE` | Long              | Return intervals' start times and duration times in which the value is always not 0, and the duration time `t` satisfy `t >= min && t <= max`. The unit of `t` is ms         |
-| ZERO_COUNT        | INT32/ INT64/ FLOAT/ DOUBLE/ BOOLEAN | `min`:Optional with default value `1L`</br>`max`:Optional with default value `Long.MAX_VALUE` | Long              | Return intervals' start times and the number of data points in the interval in which the value is always 0(false). Data points number `n` satisfy `n >= min && n <= max`     |
-| NON_ZERO_COUNT    | INT32/ INT64/ FLOAT/ DOUBLE/ BOOLEAN | `min`:Optional with default value `1L`</br>`max`:Optional with default value `Long.MAX_VALUE` | Long              | Return intervals' start times and the number of data points in the interval in which the value is always not 0(false). Data points number `n` satisfy `n >= min && n <= max` |
-
-##### Demonstrate
-Example data:
-```
-IoTDB> select s1,s2,s3,s4,s5 from root.sg.d2;
-+-----------------------------+-------------+-------------+-------------+-------------+-------------+
-|                         Time|root.sg.d2.s1|root.sg.d2.s2|root.sg.d2.s3|root.sg.d2.s4|root.sg.d2.s5|
-+-----------------------------+-------------+-------------+-------------+-------------+-------------+
-|1970-01-01T08:00:00.000+08:00|            0|            0|          0.0|          0.0|        false|
-|1970-01-01T08:00:00.001+08:00|            1|            1|          1.0|          1.0|         true|
-|1970-01-01T08:00:00.002+08:00|            1|            1|          1.0|          1.0|         true|
-|1970-01-01T08:00:00.003+08:00|            0|            0|          0.0|          0.0|        false|
-|1970-01-01T08:00:00.004+08:00|            1|            1|          1.0|          1.0|         true|
-|1970-01-01T08:00:00.005+08:00|            0|            0|          0.0|          0.0|        false|
-|1970-01-01T08:00:00.006+08:00|            0|            0|          0.0|          0.0|        false|
-|1970-01-01T08:00:00.007+08:00|            1|            1|          1.0|          1.0|         true|
-+-----------------------------+-------------+-------------+-------------+-------------+-------------+
-```
-
-Sql:
-```sql
-select s1, zero_count(s1), non_zero_count(s2), zero_duration(s3), non_zero_duration(s4) from root.sg.d2;
-```
-
-Result:
-```
-+-----------------------------+-------------+-------------------------+-----------------------------+----------------------------+--------------------------------+
-|                         Time|root.sg.d2.s1|zero_count(root.sg.d2.s1)|non_zero_count(root.sg.d2.s2)|zero_duration(root.sg.d2.s3)|non_zero_duration(root.sg.d2.s4)|
-+-----------------------------+-------------+-------------------------+-----------------------------+----------------------------+--------------------------------+
-|1970-01-01T08:00:00.000+08:00|            0|                        1|                         null|                           0|                            null|
-|1970-01-01T08:00:00.001+08:00|            1|                     null|                            2|                        null|                               1|
-|1970-01-01T08:00:00.002+08:00|            1|                     null|                         null|                        null|                            null|
-|1970-01-01T08:00:00.003+08:00|            0|                        1|                         null|                           0|                            null|
-|1970-01-01T08:00:00.004+08:00|            1|                     null|                            1|                        null|                               0|
-|1970-01-01T08:00:00.005+08:00|            0|                        2|                         null|                           1|                            null|
-|1970-01-01T08:00:00.006+08:00|            0|                     null|                         null|                        null|                            null|
-|1970-01-01T08:00:00.007+08:00|            1|                     null|                            1|                        null|                               0|
-+-----------------------------+-------------+-------------------------+-----------------------------+----------------------------+--------------------------------+
-```
-
-### Equal Size Bucket Sample Function
-This function samples the input sequence in equal size buckets, that is, according to the downsampling ratio and downsampling method given by the user, the input sequence is equally divided into several buckets according to a fixed number of points. Sampling by the given sampling method within each bucket.
-- `proportion`: sample ratio, the value range is `(0, 1]`.
-#### Equal Size Bucket Random Sample
-Random sampling is performed on the equally divided buckets.
-
-| Function Name | Allowed Input Series Data Types | Required Attributes                           | Output Series Data Type | Series Data Type  Description                 |
-|----------|--------------------------------|---------------------------------------|------------|--------------------------------------------------|
-| EQUAL_SIZE_BUCKET_RANDOM_SAMPLE   | INT32 / INT64 / FLOAT / DOUBLE | `proportion` The value range is `(0, 1]`, the default is `0.1` | INT32 / INT64 / FLOAT / DOUBLE | Returns a random sample of equal buckets that matches the sampling ratio |
-
-##### Demonstrate
-Example data: `root.ln.wf01.wt01.temperature` has a total of `100` ordered data from `0.0-99.0`.
-```
-IoTDB> select temperature from root.ln.wf01.wt01;
-+-----------------------------+-----------------------------+
-|                         Time|root.ln.wf01.wt01.temperature|
-+-----------------------------+-----------------------------+
-|1970-01-01T08:00:00.000+08:00|                          0.0|
-|1970-01-01T08:00:00.001+08:00|                          1.0|
-|1970-01-01T08:00:00.002+08:00|                          2.0|
-|1970-01-01T08:00:00.003+08:00|                          3.0|
-|1970-01-01T08:00:00.004+08:00|                          4.0|
-|1970-01-01T08:00:00.005+08:00|                          5.0|
-|1970-01-01T08:00:00.006+08:00|                          6.0|
-|1970-01-01T08:00:00.007+08:00|                          7.0|
-|1970-01-01T08:00:00.008+08:00|                          8.0|
-|1970-01-01T08:00:00.009+08:00|                          9.0|
-|1970-01-01T08:00:00.010+08:00|                         10.0|
-|1970-01-01T08:00:00.011+08:00|                         11.0|
-|1970-01-01T08:00:00.012+08:00|                         12.0|
-|.............................|.............................|            
-|1970-01-01T08:00:00.089+08:00|                         89.0|
-|1970-01-01T08:00:00.090+08:00|                         90.0|
-|1970-01-01T08:00:00.091+08:00|                         91.0|
-|1970-01-01T08:00:00.092+08:00|                         92.0|
-|1970-01-01T08:00:00.093+08:00|                         93.0|
-|1970-01-01T08:00:00.094+08:00|                         94.0|
-|1970-01-01T08:00:00.095+08:00|                         95.0|
-|1970-01-01T08:00:00.096+08:00|                         96.0|
-|1970-01-01T08:00:00.097+08:00|                         97.0|
-|1970-01-01T08:00:00.098+08:00|                         98.0|
-|1970-01-01T08:00:00.099+08:00|                         99.0|
-+-----------------------------+-----------------------------+
-```
-Sql:
-```sql
-select equal_size_bucket_random_sample(temperature,'proportion'='0.1') as random_sample from root.ln.wf01.wt01;
-```
-Result:
-```
-+-----------------------------+-------------+
-|                         Time|random_sample|
-+-----------------------------+-------------+
-|1970-01-01T08:00:00.007+08:00|          7.0|
-|1970-01-01T08:00:00.014+08:00|         14.0|
-|1970-01-01T08:00:00.020+08:00|         20.0|
-|1970-01-01T08:00:00.035+08:00|         35.0|
-|1970-01-01T08:00:00.047+08:00|         47.0|
-|1970-01-01T08:00:00.059+08:00|         59.0|
-|1970-01-01T08:00:00.063+08:00|         63.0|
-|1970-01-01T08:00:00.079+08:00|         79.0|
-|1970-01-01T08:00:00.086+08:00|         86.0|
-|1970-01-01T08:00:00.096+08:00|         96.0|
-+-----------------------------+-------------+
-Total line number = 10
-It costs 0.024s
-```
-
-#### Equal Size Bucket Aggregation Sample
-
-The input sequence is sampled by the aggregation sampling method, and the user needs to provide an additional aggregation function parameter, namely
-- `type`: Aggregate type, which can be `avg` or `max` or `min` or `sum` or `extreme` or `variance`. By default, `avg` is used. `extreme` represents the value with the largest absolute value in the equal bucket. `variance` represents the variance in the sampling equal buckets.
-
-The timestamp of the sampling output of each bucket is the timestamp of the first point of the bucket.
-
-| Function Name | Allowed Input Series Data Types | Required Attributes                           | Output Series Data Type | Series Data Type  Description                 |
-|----------|--------------------------------|---------------------------------------|------------|--------------------------------------------------|
-| EQUAL_SIZE_BUCKET_AGG_SAMPLE | INT32 / INT64 / FLOAT / DOUBLE | `proportion` The value range is `(0, 1]`, the default is `0.1`</br>`type`: The value types are `avg`, `max`, `min`, `sum`, `extreme`, `variance`, the default is `avg` | INT32 / INT64 / FLOAT / DOUBLE | Returns equal bucket aggregation samples that match the sampling ratio |
-
-##### Demonstrate
-Example data: `root.ln.wf01.wt01.temperature` has a total of `100` ordered data from `0.0-99.0`, and the test data is randomly sampled in equal buckets.
-
-Sql:
-```sql
-select equal_size_bucket_agg_sample(temperature, 'type'='avg','proportion'='0.1') as agg_avg, equal_size_bucket_agg_sample(temperature, 'type'='max','proportion'='0.1') as agg_max, equal_size_bucket_agg_sample(temperature,'type'='min','proportion'='0.1') as agg_min, equal_size_bucket_agg_sample(temperature, 'type'='sum','proportion'='0.1') as agg_sum, equal_size_bucket_agg_sample(temperature, 'type'='extreme','proportion'='0.1') as agg_extreme, equal_size_bucket_agg_sample(temperature, ' [...]
-```
-Result:
-```
-+-----------------------------+-----------------+-------+-------+-------+-----------+------------+
-|                         Time|          agg_avg|agg_max|agg_min|agg_sum|agg_extreme|agg_variance|
-+-----------------------------+-----------------+-------+-------+-------+-----------+------------+
-|1970-01-01T08:00:00.000+08:00|              4.5|    9.0|    0.0|   45.0|        9.0|        8.25|
-|1970-01-01T08:00:00.010+08:00|             14.5|   19.0|   10.0|  145.0|       19.0|        8.25|
-|1970-01-01T08:00:00.020+08:00|             24.5|   29.0|   20.0|  245.0|       29.0|        8.25|
-|1970-01-01T08:00:00.030+08:00|             34.5|   39.0|   30.0|  345.0|       39.0|        8.25|
-|1970-01-01T08:00:00.040+08:00|             44.5|   49.0|   40.0|  445.0|       49.0|        8.25|
-|1970-01-01T08:00:00.050+08:00|             54.5|   59.0|   50.0|  545.0|       59.0|        8.25|
-|1970-01-01T08:00:00.060+08:00|             64.5|   69.0|   60.0|  645.0|       69.0|        8.25|
-|1970-01-01T08:00:00.070+08:00|74.50000000000001|   79.0|   70.0|  745.0|       79.0|        8.25|
-|1970-01-01T08:00:00.080+08:00|             84.5|   89.0|   80.0|  845.0|       89.0|        8.25|
-|1970-01-01T08:00:00.090+08:00|             94.5|   99.0|   90.0|  945.0|       99.0|        8.25|
-+-----------------------------+-----------------+-------+-------+-------+-----------+------------+
-Total line number = 10
-It costs 0.044s
-```
-#### Equal Size Bucket M4 Sample
-
-The input sequence is sampled using the M4 sampling method. That is to sample the head, tail, min and max values for each bucket.
-
-| Function Name | Allowed Input Series Data Types | Required Attributes                           | Output Series Data Type | Series Data Type  Description                 |
-|----------|--------------------------------|---------------------------------------|------------|--------------------------------------------------|
-| EQUAL_SIZE_BUCKET_M4_SAMPLE | INT32 / INT64 / FLOAT / DOUBLE | `proportion` The value range is `(0, 1]`, the default is `0.1` | INT32 / INT64 / FLOAT / DOUBLE | Returns equal bucket M4 samples that match the sampling ratio |
-
-
-##### Demonstrate
-Example data: `root.ln.wf01.wt01.temperature` has a total of `100` ordered data from `0.0-99.0`, and the test data is randomly sampled in equal buckets.
-
-Sql:
-```sql
-select equal_size_bucket_m4_sample(temperature, 'proportion'='0.1') as M4_sample from root.ln.wf01.wt01;
-```
-Result:
-```
-+-----------------------------+---------+
-|                         Time|M4_sample|
-+-----------------------------+---------+
-|1970-01-01T08:00:00.000+08:00|      0.0|
-|1970-01-01T08:00:00.001+08:00|      1.0|
-|1970-01-01T08:00:00.038+08:00|     38.0|
-|1970-01-01T08:00:00.039+08:00|     39.0|
-|1970-01-01T08:00:00.040+08:00|     40.0|
-|1970-01-01T08:00:00.041+08:00|     41.0|
-|1970-01-01T08:00:00.078+08:00|     78.0|
-|1970-01-01T08:00:00.079+08:00|     79.0|
-|1970-01-01T08:00:00.080+08:00|     80.0|
-|1970-01-01T08:00:00.081+08:00|     81.0|
-|1970-01-01T08:00:00.098+08:00|     98.0|
-|1970-01-01T08:00:00.099+08:00|     99.0|
-+-----------------------------+---------+
-Total line number = 12
-It costs 0.065s
-```
-#### Equal Size Bucket Outlier Sample
-This function samples the input sequence with equal number of bucket outliers, that is, according to the downsampling ratio given by the user and the number of samples in the bucket, the input sequence is divided into several buckets according to a fixed number of points. Sampling by the given outlier sampling method within each bucket.
-
-| Function Name | Allowed Input Series Data Types | Required Attributes                           | Output Series Data Type | Series Data Type  Description                 |
-|----------|--------------------------------|---------------------------------------|------------|--------------------------------------------------|
-| EQUAL_SIZE_BUCKET_OUTLIER_SAMPLE | INT32 / INT64 / FLOAT / DOUBLE | The value range of `proportion` is `(0, 1]`, the default is `0.1`</br> The value of `type` is `avg` or `stendis` or `cos` or `prenextdis`, the default is `avg` </br>The value of `number` should be greater than 0, the default is `3`| INT32 / INT64 / FLOAT / DOUBLE | Returns outlier samples in equal buckets that match the sampling ratio and the number of samples in the bucket |
-
-Parameter Description
-- `proportion`: sampling ratio
-- `number`: the number of samples in each bucket, default `3`
-- `type`: outlier sampling method, the value is
-  - `avg`: Take the average of the data points in the bucket, and find the `top number` farthest from the average according to the sampling ratio
-  - `stendis`: Take the vertical distance between each data point in the bucket and the first and last data points of the bucket to form a straight line, and according to the sampling ratio, find the `top number` with the largest distance
-  - `cos`: Set a data point in the bucket as b, the data point on the left of b as a, and the data point on the right of b as c, then take the cosine value of the angle between the ab and bc vectors. The larger the angle, the more likely it is an outlier. Find the `top number` with the smallest cos value
-  - `prenextdis`: Let a data point in the bucket be b, the data point to the left of b is a, and the data point to the right of b is c, then take the sum of the lengths of ab and bc as the yardstick, the larger the sum, the more likely it is to be an outlier, and find the `top number` with the largest sum value
-
-##### Demonstrate
-Example data: `root.ln.wf01.wt01.temperature` has a total of `100` ordered data from `0.0-99.0`. Among them, in order to add outliers, we make the number modulo 5 equal to 0 increment by 100.
-```
-IoTDB> select temperature from root.ln.wf01.wt01;
-+-----------------------------+-----------------------------+
-|                         Time|root.ln.wf01.wt01.temperature|
-+-----------------------------+-----------------------------+
-|1970-01-01T08:00:00.000+08:00|                          0.0|
-|1970-01-01T08:00:00.001+08:00|                          1.0|
-|1970-01-01T08:00:00.002+08:00|                          2.0|
-|1970-01-01T08:00:00.003+08:00|                          3.0|
-|1970-01-01T08:00:00.004+08:00|                          4.0|
-|1970-01-01T08:00:00.005+08:00|                        105.0|
-|1970-01-01T08:00:00.006+08:00|                          6.0|
-|1970-01-01T08:00:00.007+08:00|                          7.0|
-|1970-01-01T08:00:00.008+08:00|                          8.0|
-|1970-01-01T08:00:00.009+08:00|                          9.0|
-|1970-01-01T08:00:00.010+08:00|                         10.0|
-|1970-01-01T08:00:00.011+08:00|                         11.0|
-|1970-01-01T08:00:00.012+08:00|                         12.0|
-|1970-01-01T08:00:00.013+08:00|                         13.0|
-|1970-01-01T08:00:00.014+08:00|                         14.0|
-|1970-01-01T08:00:00.015+08:00|                        115.0|
-|1970-01-01T08:00:00.016+08:00|                         16.0|
-|.............................|.............................|
-|1970-01-01T08:00:00.092+08:00|                         92.0|
-|1970-01-01T08:00:00.093+08:00|                         93.0|
-|1970-01-01T08:00:00.094+08:00|                         94.0|
-|1970-01-01T08:00:00.095+08:00|                        195.0|
-|1970-01-01T08:00:00.096+08:00|                         96.0|
-|1970-01-01T08:00:00.097+08:00|                         97.0|
-|1970-01-01T08:00:00.098+08:00|                         98.0|
-|1970-01-01T08:00:00.099+08:00|                         99.0|
-+-----------------------------+-----------------------------+
-```
-Sql:
-```sql
-select equal_size_bucket_outlier_sample(temperature, 'proportion'='0.1', 'type'='avg', 'number'='2') as outlier_avg_sample, equal_size_bucket_outlier_sample(temperature, 'proportion'='0.1', 'type'='stendis', 'number'='2') as outlier_stendis_sample, equal_size_bucket_outlier_sample(temperature, 'proportion'='0.1', 'type'='cos', 'number'='2') as outlier_cos_sample, equal_size_bucket_outlier_sample(temperature, 'proportion'='0.1', 'type'='prenextdis', 'number'='2') as outlier_prenextdis_sam [...]
-```
-Result:
-```
-+-----------------------------+------------------+----------------------+------------------+-------------------------+
-|                         Time|outlier_avg_sample|outlier_stendis_sample|outlier_cos_sample|outlier_prenextdis_sample|
-+-----------------------------+------------------+----------------------+------------------+-------------------------+
-|1970-01-01T08:00:00.005+08:00|             105.0|                 105.0|             105.0|                    105.0|
-|1970-01-01T08:00:00.015+08:00|             115.0|                 115.0|             115.0|                    115.0|
-|1970-01-01T08:00:00.025+08:00|             125.0|                 125.0|             125.0|                    125.0|
-|1970-01-01T08:00:00.035+08:00|             135.0|                 135.0|             135.0|                    135.0|
-|1970-01-01T08:00:00.045+08:00|             145.0|                 145.0|             145.0|                    145.0|
-|1970-01-01T08:00:00.055+08:00|             155.0|                 155.0|             155.0|                    155.0|
-|1970-01-01T08:00:00.065+08:00|             165.0|                 165.0|             165.0|                    165.0|
-|1970-01-01T08:00:00.075+08:00|             175.0|                 175.0|             175.0|                    175.0|
-|1970-01-01T08:00:00.085+08:00|             185.0|                 185.0|             185.0|                    185.0|
-|1970-01-01T08:00:00.095+08:00|             195.0|                 195.0|             195.0|                    195.0|
-+-----------------------------+------------------+----------------------+------------------+-------------------------+
-Total line number = 10
-It costs 0.041s
-```
-
-### M4 Function
-
-M4 is used to sample the `first, last, bottom, top` points for each sliding window:
+   - aggregate functions
+   - Time series generation functions (including built-in functions and user-defined functions)
+- constant
 
--   the first point is the point with the **m**inimal time;
--   the last point is the point with the **m**aximal time;
--   the bottom point is the point with the **m**inimal value (if there are multiple such points, M4 returns one of them);
--   the top point is the point with the **m**aximal value (if there are multiple such points, M4 returns one of them).
-
-<img src="https://user-images.githubusercontent.com/33376433/198178733-a0919d17-0663-4672-9c4f-1efad6f463c2.png" alt="image" style="zoom:50%;" />
-
-| Function Name | Allowed Input Series Data Types | Attributes                                                   | Output Series Data Type        | Series Data Type  Description                                |
-| ------------- | ------------------------------- | ------------------------------------------------------------ | ------------------------------ | ------------------------------------------------------------ |
-| M4            | INT32 / INT64 / FLOAT / DOUBLE  | Different attributes used by the size window and the time window. The size window uses attributes `windowSize` and `slidingStep`. The time window uses attributes `timeInterval`, `slidingStep`, `displayWindowBegin`, and `displayWindowEnd`. More details see below. | INT32 / INT64 / FLOAT / DOUBLE | Returns the `first, last, bottom, top` points in each sliding window. M4 sorts and deduplicates the aggregated points within the window before [...]
-
-#### Attributes
-
-**(1) Attributes for the size window:**
-
-+ `windowSize`: The number of points in a window. Int data type. **Required**.
-+ `slidingStep`: Slide a window by the number of points. Int data type. Optional. If not set, default to the same as `windowSize`.
-
-<img src="https://user-images.githubusercontent.com/33376433/198181449-00d563c8-7bce-4ecd-a031-ec120ca42c3f.png" alt="image" style="zoom: 50%;" />
-
-*(image source: https://iotdb.apache.org/UserGuide/Master/Process-Data/UDF-User-Defined-Function.html#udtf-user-defined-timeseries-generating-function)*
-
-**(2) Attributes for the time window:**
-
-+ `timeInterval`: The time interval length of a window. Long data type. **Required**.
-+ `slidingStep`: Slide a window by the time length. Long data type. Optional. If not set, default to the same as `timeInterval`.
-+ `displayWindowBegin`: The starting position of the window (included). Long data type. Optional. If not set, default to Long.MIN_VALUE, meaning using the time of the first data point of the input time series as the starting position of the window.
-+ `displayWindowEnd`: End time limit (excluded, essentially playing the same role as `WHERE time < displayWindowEnd`). Long data type. Optional. If not set, default to Long.MAX_VALUE, meaning there is no additional end time limit other than the end of the input time series itself.
-
-<img src="https://user-images.githubusercontent.com/33376433/198183015-93b56644-3330-4acf-ae9e-d718a02b5f4c.png" alt="groupBy window" style="zoom: 67%;" />
-
-*(image source: https://iotdb.apache.org/UserGuide/Master/Query-Data/Aggregate-Query.html#downsampling-aggregate-query)*
-
-#### Examples
-
-Input series:
-
-```sql
-+-----------------------------+------------------+
-|                         Time|root.vehicle.d1.s1|
-+-----------------------------+------------------+
-|1970-01-01T08:00:00.001+08:00|               5.0|
-|1970-01-01T08:00:00.002+08:00|              15.0|
-|1970-01-01T08:00:00.005+08:00|              10.0|
-|1970-01-01T08:00:00.008+08:00|               8.0|
-|1970-01-01T08:00:00.010+08:00|              30.0|
-|1970-01-01T08:00:00.020+08:00|              20.0|
-|1970-01-01T08:00:00.025+08:00|               8.0|
-|1970-01-01T08:00:00.027+08:00|              20.0|
-|1970-01-01T08:00:00.030+08:00|              40.0|
-|1970-01-01T08:00:00.033+08:00|               9.0|
-|1970-01-01T08:00:00.035+08:00|              10.0|
-|1970-01-01T08:00:00.040+08:00|              20.0|
-|1970-01-01T08:00:00.045+08:00|              30.0|
-|1970-01-01T08:00:00.052+08:00|               8.0|
-|1970-01-01T08:00:00.054+08:00|              18.0|
-+-----------------------------+------------------+
-```
-
-SQL for query1:
-
-```sql
-select M4(s1,'timeInterval'='25','displayWindowBegin'='0','displayWindowEnd'='100') from root.vehicle.d1
-```
-
-Output1:
-
-```sql
-+-----------------------------+-----------------------------------------------------------------------------------------------+
-|                         Time|M4(root.vehicle.d1.s1, "timeInterval"="25", "displayWindowBegin"="0", "displayWindowEnd"="100")|
-+-----------------------------+-----------------------------------------------------------------------------------------------+
-|1970-01-01T08:00:00.001+08:00|                                                                                            5.0|
-|1970-01-01T08:00:00.010+08:00|                                                                                           30.0|
-|1970-01-01T08:00:00.020+08:00|                                                                                           20.0|
-|1970-01-01T08:00:00.025+08:00|                                                                                            8.0|
-|1970-01-01T08:00:00.030+08:00|                                                                                           40.0|
-|1970-01-01T08:00:00.045+08:00|                                                                                           30.0|
-|1970-01-01T08:00:00.052+08:00|                                                                                            8.0|
-|1970-01-01T08:00:00.054+08:00|                                                                                           18.0|
-+-----------------------------+-----------------------------------------------------------------------------------------------+
-Total line number = 8
-```
-
-SQL for query2:
+## Use Alias
 
-```sql
-select M4(s1,'windowSize'='10') from root.vehicle.d1
-```
+Since the unique data model of IoTDB, lots of additional information like device will be carried before each sensor. Sometimes, we want to query just one specific device, then these prefix information show frequently will be redundant in this situation, influencing the analysis of result set. At this time, we can use `AS` function provided by IoTDB, assign an alias to time series selected in query.  
 
-Output2:
+For example:
 
 ```sql
-+-----------------------------+-----------------------------------------+
-|                         Time|M4(root.vehicle.d1.s1, "windowSize"="10")|
-+-----------------------------+-----------------------------------------+
-|1970-01-01T08:00:00.001+08:00|                                      5.0|
-|1970-01-01T08:00:00.030+08:00|                                     40.0|
-|1970-01-01T08:00:00.033+08:00|                                      9.0|
-|1970-01-01T08:00:00.035+08:00|                                     10.0|
-|1970-01-01T08:00:00.045+08:00|                                     30.0|
-|1970-01-01T08:00:00.052+08:00|                                      8.0|
-|1970-01-01T08:00:00.054+08:00|                                     18.0|
-+-----------------------------+-----------------------------------------+
-Total line number = 7
+select s1 as temperature, s2 as speed from root.ln.wf01.wt01;
 ```
 
+The result set is:
 
+| Time | temperature | speed |
+| ---- | ----------- | ----- |
+| ...  | ...         | ...   |
 
-#### Suggested Use Cases
-
-**(1) Use Case: Extreme-point-preserving downsampling**
-
-As M4 aggregation selects the `first, last, bottom, top` points for each window, M4 usually preserves extreme points and thus patterns better than other downsampling methods such as Piecewise Aggregate Approximation (PAA). Therefore, if you want to downsample the time series while preserving extreme points, you may give M4 a try.
-
-**(2) Use case: Error-free two-color line chart visualization of large-scale time series using reduced data**
-
-Refer to paper: ["M4: A Visualization-Oriented Time Series Data Aggregation"](http://www.vldb.org/pvldb/vol7/p797-jugel.pdf).
-
-Given a chart of `w*h` pixels, suppose the visualization time range of the time series root.vehicle.d1.s1 is `[tqs,tqe)`(in this use case please extend tqe to make sure (tqe-tqs) is divisible by w), the points that fall within the  `i`-th time span `Ii=[tqs+(tqe-tqs)/w*(i-1),tqs+(tqe-tqs)/w*i)` will be drawn on the `i`-th pixel column, i=1,2,...,w.
-
-Therefore, from a visualization-driven perspective, use the sql: `"select M4(s1,'timeInterval'='(tqe-tqs)/w','displayWindowBegin'='tqs','displayWindowEnd'='tqe') from root.vehicle.d1"` to sample the `first, last, bottom, top` points for each time span. The resulting series has no more than `4*w` points, a big reduction compared to the original large-scale time series. The line chart drawn from the reduced data is identical that to that drawn from the original data (pixel-level consistency).
-
-
-
-#### Comparison with Other SQL
-
-| SQL                                                          | Whether support M4 aggregation                               | Sliding window type                               | Example                                                      | Docs                                                         |
-| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
-| 1. native built-in aggregate functions with Group By clause  | No. Lack `BOTTOM_TIME` and `TOP_TIME`, which are respectively the time of the points that have the mininum and maximum value. | Time Window                                       | `select count(status), max_value(temperature) from root.ln.wf01.wt01 group by ([2017-11-01 00:00:00, 2017-11-07 23:00:00), 3h, 1d)` | https://iotdb.apache.org/UserGuide/Master/Query-Data/Aggregate-Query.html#built-in-aggregate-functions <br />http [...]
-| 2. EQUAL_SIZE_BUCKET_M4_SAMPLE (built-in UDF)                | Yes*                                                         | Size Window. `windowSize = 4*(int)(1/proportion)` | `select equal_size_bucket_m4_sample(temperature, 'proportion'='0.1') as M4_sample from root.ln.wf01.wt01` | https://iotdb.apache.org/UserGuide/Master/Query-Data/Select-Expression.html#time-series-generating-functions |
-| **3. M4 (built-in UDF)**                                     | Yes*                                                         | Size Window, Time Window                          | (1) Size Window: `select M4(s1,'windowSize'='10') from root.vehicle.d1` <br />(2) Time Window: `select M4(s1,'timeInterval'='25','displayWindowBegin'='0','displayWindowEnd'='100') from root.vehicle.d1` | refer to this doc                                            |
-| 4. extend native built-in aggregate functions with Group By clause to support M4 aggregation | not implemented                                              | not implemented                                   | not implemented                                              | not implemented                                              |
-
-Further compare `EQUAL_SIZE_BUCKET_M4_SAMPLE` and `M4`:
 
-**(1) Different M4 aggregation definition:**
+## Operator
 
-For each window, `EQUAL_SIZE_BUCKET_M4_SAMPLE` extracts the top and bottom points from points **EXCLUDING** the first and last points.
+See the documentation [Operators and Functions](../Operators-Functions/Overview.md) for a list of operators supported in IoTDB.
 
-In contrast, `M4` extracts the top and bottom points from points **INCLUDING** the first and last points, which is more consistent with the semantics of `max_value` and `min_value` stored in metadata.
+## Function
 
-It is worth noting that both functions sort and deduplicate the aggregated points in a window before outputting them to the collectors.
+### aggregate functions
 
-**(2) Different sliding windows:** 
+Aggregate functions are many-to-one functions. They perform aggregate calculations on a set of values, resulting in a single aggregated result.
 
-`EQUAL_SIZE_BUCKET_M4_SAMPLE` uses SlidingSizeWindowAccessStrategy and **indirectly** controls sliding window size by sampling proportion. The conversion formula is `windowSize = 4*(int)(1/proportion)`. 
+**A query that contains an aggregate function is called an aggregate query**, otherwise, it is called a time series query.
 
-`M4` supports two types of sliding window: SlidingSizeWindowAccessStrategy and SlidingTimeWindowAccessStrategy. `M4` **directly** controls the window point size or time length using corresponding parameters.
+> Please note that mixed use of `Aggregate Query` and `Timeseries Query` is not allowed. Below are examples for queries that are not allowed.
+>
+> ```
+> select a, count(a) from root.sg 
+> select sin(a), count(a) from root.sg
+> select a, count(a) from root.sg group by ([10,100),10ms)
+> ```
 
+For the aggregation functions supported by IoTDB, see the document [Aggregation Functions](../Operators-Functions/Aggregation.md).
 
+### Time series generation function
 
-### JEXL Function
+A time series generation function takes several raw time series as input and produces a list of time series as output. Unlike aggregate functions, time series generators have a timestamp column in their result sets.
 
-Java Expression Language (JEXL) is an expression language engine. We use JEXL to extend UDFs, which are implemented on the command line with simple lambda expressions. See the link for [operators supported in jexl lambda expressions](https://commons.apache.org/proper/commons-jexl/apidocs/org/apache/commons/jexl3/package-summary.html#customization).
+All time series generation functions accept * as input, and all can be mixed with raw time series queries.
 
-| Function Name | Allowed Input Series Data Types | Required Attributes                           | Output Series Data Type | Series Data Type  Description                 |
-|----------|--------------------------------|---------------------------------------|------------|--------------------------------------------------|
-| JEXL   | INT32 / INT64 / FLOAT / DOUBLE / TEXT / BOOLEAN | `expr` is a lambda expression that supports standard one or multi arguments in the form `x -> {...}` or `(x, y, z) -> {...}`, e.g. ` x -> {x * 2}`, `(x, y, z) -> {x + y * z}` | INT32 / INT64 / FLOAT / DOUBLE / TEXT / BOOLEAN | Returns the input time series transformed by a lambda expression |
+#### Built-in time series generation functions
 
-#### Demonstrate
-Example data: `root.ln.wf01.wt01.temperature`, `root.ln.wf01.wt01.st`, `root.ln.wf01.wt01.str` a total of `11` data.
+See the documentation [Operators and Functions](../Operators-Functions/Overview.md) for a list of built-in functions supported in IoTDB.
 
-```
-IoTDB> select * from root.ln.wf01.wt01;
-+-----------------------------+---------------------+--------------------+-----------------------------+
-|                         Time|root.ln.wf01.wt01.str|root.ln.wf01.wt01.st|root.ln.wf01.wt01.temperature|
-+-----------------------------+---------------------+--------------------+-----------------------------+
-|1970-01-01T08:00:00.000+08:00|                  str|                10.0|                          0.0|
-|1970-01-01T08:00:00.001+08:00|                  str|                20.0|                          1.0|
-|1970-01-01T08:00:00.002+08:00|                  str|                30.0|                          2.0|
-|1970-01-01T08:00:00.003+08:00|                  str|                40.0|                          3.0|
-|1970-01-01T08:00:00.004+08:00|                  str|                50.0|                          4.0|
-|1970-01-01T08:00:00.005+08:00|                  str|                60.0|                          5.0|
-|1970-01-01T08:00:00.006+08:00|                  str|                70.0|                          6.0|
-|1970-01-01T08:00:00.007+08:00|                  str|                80.0|                          7.0|
-|1970-01-01T08:00:00.008+08:00|                  str|                90.0|                          8.0|
-|1970-01-01T08:00:00.009+08:00|                  str|               100.0|                          9.0|
-|1970-01-01T08:00:00.010+08:00|                  str|               110.0|                         10.0|
-+-----------------------------+---------------------+--------------------+-----------------------------+
-```
-Sql:
-```sql
-select jexl(temperature, 'expr'='x -> {x + x}') as jexl1, jexl(temperature, 'expr'='x -> {x * 3}') as jexl2, jexl(temperature, 'expr'='x -> {x * x}') as jexl3, jexl(temperature, 'expr'='x -> {multiply(x, 100)}') as jexl4, jexl(temperature, st, 'expr'='(x, y) -> {x + y}') as jexl5, jexl(temperature, st, str, 'expr'='(x, y, z) -> {x + y + z}') as jexl6 from root.ln.wf01.wt01;```
-```
+#### User-Defined time series generation function
 
-Result:
-```
-+-----------------------------+-----+-----+-----+------+-----+--------+
-|                         Time|jexl1|jexl2|jexl3| jexl4|jexl5|   jexl6|
-+-----------------------------+-----+-----+-----+------+-----+--------+
-|1970-01-01T08:00:00.000+08:00|  0.0|  0.0|  0.0|   0.0| 10.0| 10.0str|
-|1970-01-01T08:00:00.001+08:00|  2.0|  3.0|  1.0| 100.0| 21.0| 21.0str|
-|1970-01-01T08:00:00.002+08:00|  4.0|  6.0|  4.0| 200.0| 32.0| 32.0str|
-|1970-01-01T08:00:00.003+08:00|  6.0|  9.0|  9.0| 300.0| 43.0| 43.0str|
-|1970-01-01T08:00:00.004+08:00|  8.0| 12.0| 16.0| 400.0| 54.0| 54.0str|
-|1970-01-01T08:00:00.005+08:00| 10.0| 15.0| 25.0| 500.0| 65.0| 65.0str|
-|1970-01-01T08:00:00.006+08:00| 12.0| 18.0| 36.0| 600.0| 76.0| 76.0str|
-|1970-01-01T08:00:00.007+08:00| 14.0| 21.0| 49.0| 700.0| 87.0| 87.0str|
-|1970-01-01T08:00:00.008+08:00| 16.0| 24.0| 64.0| 800.0| 98.0| 98.0str|
-|1970-01-01T08:00:00.009+08:00| 18.0| 27.0| 81.0| 900.0|109.0|109.0str|
-|1970-01-01T08:00:00.010+08:00| 20.0| 30.0|100.0|1000.0|120.0|120.0str|
-+-----------------------------+-----+-----+-----+------+-----+--------+
-Total line number = 11
-It costs 0.118s
-```
-
-### User Defined Timeseries Generating Functions
-
-Please refer to [UDF (User Defined Function)](../Process-Data/UDF-User-Defined-Function.md).
-
-Known Implementation UDF Libraries:
-
-+ [IoTDB-Quality](https://thulab.github.io/iotdb-quality), a UDF library about data quality, including data profiling, data quality evalution and data repairing, etc.
+IoTDB supports function extension through [User-Defined Function](./User-Defined-Function.md) capability.
 
 ## Nested Expressions
 
@@ -1295,18 +320,5 @@ It costs 0.012s
 - Only when the left operand and the right operand under a certain timestamp are not `null`, the nested expressions will have an output value. Otherwise this row will not be included in the result. But for nested expressions with `GROUP BY` clause, it is better to show the result of all time intervals. Please refer to Input3 and corresponding Result3 in Example.
 - If one operand in the nested expressions can be translated into multiple time series (For example, `*`), the result of each time series will be included in the result (Cartesian product). Please refer to Input2 and corresponding Result2 in Example.
 
-## Use Alias
 
-Since the unique data model of IoTDB, lots of additional information like device will be carried before each sensor. Sometimes, we want to query just one specific device, then these prefix information show frequently will be redundant in this situation, influencing the analysis of result set. At this time, we can use `AS` function provided by IoTDB, assign an alias to time series selected in query.  
-
-For example:
 
-```sql
-select s1 as temperature, s2 as speed from root.ln.wf01.wt01;
-```
-
-The result set is:
-
-| Time | temperature | speed |
-| ---- | ----------- | ----- |
-| ...  | ...         | ...   |
diff --git a/docs/UserGuide/Process-Data/Select-Into.md b/docs/UserGuide/Query-Data/Select-Into.md
similarity index 100%
rename from docs/UserGuide/Process-Data/Select-Into.md
rename to docs/UserGuide/Query-Data/Select-Into.md
diff --git a/docs/UserGuide/Query-Data/Query-Filter.md b/docs/UserGuide/Query-Data/Where-Condition.md
similarity index 100%
rename from docs/UserGuide/Query-Data/Query-Filter.md
rename to docs/UserGuide/Query-Data/Where-Condition.md
diff --git a/docs/zh/UserGuide/Query-Data/Align-By.md b/docs/zh/UserGuide/Query-Data/Align-By.md
index d2747c6afe..83b9bbc18f 100644
--- a/docs/zh/UserGuide/Query-Data/Align-By.md
+++ b/docs/zh/UserGuide/Query-Data/Align-By.md
@@ -31,7 +31,7 @@
 
 在按设备对齐模式下,设备名会单独作为一列出现,查询结果集包含一列时间列、一列设备列和若干个值列。如果 `SELECT` 子句中选择了 `N` 列,则结果集包含 `N + 2` 列(时间列和设备名字列)。
 
-在默认情况下,结果集按照 `Device` 进行字典序排序,在每个 `Device` 内按照 `Time` 列升序排序。
+在默认情况下,结果集按照 `Device` 进行排列,在每个 `Device` 内按照 `Time` 列升序排序。
 
 当查询多个设备时,要求设备之间同名的列数据类型相同。
 
diff --git a/site/src/main/.vuepress/config.js b/site/src/main/.vuepress/config.js
index d6bb3a0bde..06516a5e28 100644
--- a/site/src/main/.vuepress/config.js
+++ b/site/src/main/.vuepress/config.js
@@ -922,23 +922,48 @@ var config = {
 						title: 'Query Data',
 						sidebarDepth: 1,
 						children: [
-							['Query-Data/Overview.md','Overview'],
-							['Query-Data/Select-Expression.md','Select Expression'],
-							['Query-Data/Query-Filter.md','Query Filter'],
-							['Query-Data/Pagination.md','Pagination'],
-							['Query-Data/Result-Format.md','Query Result Formats'],
-							['Query-Data/Aggregate-Query.md','Aggregate Query'],
-							['Query-Data/Last-Query.md','Last Query'],
-							['Query-Data/Fill-Null-Value.md','Fill Null Value']
-						]
-					},
-					{
-						title: 'Process Data',
+							['Query-Data/Overview','Overview'],
+							['Query-Data/Select-Expression','Select Expression'],
+							['Query-Data/Last-Query','Last Query'],
+							['Query-Data/Align-By','Query Alignment Mode'],
+							['Query-Data/Where-Condition','Where Condition'],
+							['Query-Data/Group-By','Group By'],
+							['Query-Data/Having-Condition','Having Condition'],
+							// ['Query-Data/Order-By','Order By'],
+							['Query-Data/Fill','Fill Null Value'],
+							['Query-Data/Pagination','Pagination'],
+							['Query-Data/Select-Into','Select Into'],
+							['Query-Data/Continuous-Query','Continuous Query'],
+						]
+					},
+					{
+						title: 'Operators and Functions',
 						sidebarDepth: 1,
 						children: [
-							['Process-Data/UDF-User-Defined-Function','UDF (User Defined Function)'],
-							['Process-Data/Select-Into','Query Write-back (SELECT INTO)'],
-							['Process-Data/Continuous-Query','CQ (Continuous Query)']
+							['Operators-Functions/Overview','Overview'],
+							['Operators-Functions/User-Defined-Function','UDF (User Defined Function)'],
+							['Operators-Functions/Aggregation','Aggregation'],
+							['Operators-Functions/Mathematical','Mathematical'],
+							['Operators-Functions/Comparison','Comparison'],
+							['Operators-Functions/Logical','Logical'],
+							['Operators-Functions/String','Conversion'],
+							['Operators-Functions/Conversion','Conversion'],
+							['Operators-Functions/Constant','Constant'],
+							['Operators-Functions/Selection','Selection'],
+							['Operators-Functions/Continuous-Interval','Continuous Interval'],
+							['Operators-Functions/Variation-Trend','Variation Trend'],
+							['Operators-Functions/Sample','Sample'],
+							['Operators-Functions/Time-Series','Time-Series'],
+							['Operators-Functions/Lambda','Lambda'],
+
+							// IoTDB-Quality
+							['Operators-Functions/Data-Profiling','Data Profiling'],
+							['Operators-Functions/Anomaly-Detection','Anomaly Detection'],
+							['Operators-Functions/Data-Matching','Data Matching'],
+							['Operators-Functions/Frequency-Domain','Frequency Domain'],
+							['Operators-Functions/Data-Quality','Data Quality'],
+							['Operators-Functions/Data-Repairing','Data Repairing'],
+							['Operators-Functions/Series-Discovery','Series Discovery']
 						]
 					},
 					{
@@ -1011,23 +1036,6 @@ var config = {
 							['Cluster/Cluster-Setup','Cluster Setup']
 						]
 					},
-					{
-					    title: 'UDF Library',
-					    sidebarDepth: 1,
-					    children: [
-					        ['UDF-Library/Quick-Start', 'Quick Start'],
-					        ['UDF-Library/Data-Profiling', 'Data Profiling'],
-					        ['UDF-Library/Anomaly-Detection', 'Anomaly Detection'],
-					        ['UDF-Library/Data-Matching', 'Data Matching'],
-					        ['UDF-Library/Frequency-Domain', 'Frequency Domain Analysis'],
-					        ['UDF-Library/Data-Quality', 'Data Quality'],
-					        ['UDF-Library/Data-Repairing', 'Data Repairing'],
-					        ['UDF-Library/Series-Discovery', 'Series Discovery'],
-					        ['UDF-Library/Series-Processing', 'Series Processing'],
-                            ['UDF-Library/String-Processing', 'String Processing'],
-                            ['UDF-Library/M4', 'M4']
-					    ]
-					},
 					{
 						title: 'FAQ',
 						children: [