diff --git a/src/UserGuide/Master/Table/SQL-Manual/Basis-Function.md b/src/UserGuide/Master/Table/SQL-Manual/Basis-Function.md
index 98f992ba0..2a5dfcc2b 100644
--- a/src/UserGuide/Master/Table/SQL-Manual/Basis-Function.md
+++ b/src/UserGuide/Master/Table/SQL-Manual/Basis-Function.md
@@ -154,7 +154,7 @@ SELECT LEAST(temperature,humidity) FROM table2;
2. Except for `COUNT()`, all other aggregate functions 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.
-### 2.2 Supported Aggregate Functions
+### 2.2 Supported Aggregate Functions
| Function Name | Description | Allowed Input Types | Output Type |
|:--------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------|:-------------------------------------------|
@@ -395,7 +395,7 @@ NULL OR true -- true
##### 3.2.2.1 Truth Table
-The following truth table illustrates how `NULL` is handled in `AND` and `OR` operators:
+The following truth table illustrates how `NULL` is handled in `AND` and `OR` operators:
| a | b | a AND b | a OR b |
| :---- | :---- | :------ | :----- |
@@ -469,7 +469,7 @@ date_bin(interval,source,origin)
4. If `source` is `null`, the function returns `null`.
5. Mixing months and non-month time units (e.g., `1 MONTH 1 DAY`) is not supported due to ambiguity.
-> For example, if the starting point is **April 30, 2000**, calculating `1 DAY` first and then `1 MONTH` results in **June 1, 2000**, whereas calculating `1 MONTH` first and then `1 DAY` results in **May 31, 2000**. The resulting dates are different.
+> For example, if the starting point is **April 30, 2000**, calculating `1 DAY` first and then `1 MONTH` results in **June 1, 2000**, whereas calculating `1 MONTH` first and then `1 DAY` results in **May 31, 2000**. The resulting dates are different.
#### 4.2.2 Examples
@@ -980,10 +980,10 @@ Msg: org.apache.iotdb.jdbc.IoTDBSQLException: 701: Invalid format string: %.5f (
```
3. Invalid Invocation Errors
-Triggered if:
+ Triggered if:
-* Total arguments < 2 (must include `pattern` and at least one argument).•
-* `pattern` is not of type `STRING`/`TEXT`.
+ * Total arguments < 2 (must include `pattern` and at least one argument).•
+ * `pattern` is not of type `STRING`/`TEXT`.
```SQL
-- Example 1
@@ -1006,7 +1006,7 @@ The `||` operator is used for string concatenation and functions the same as the
#### 8.1.2 LIKE Statement
-The `LIKE` statement is used for pattern matching. For detailed usage, refer to Pattern Matching:[LIKE](#1-like-运算符).
+ The `LIKE` statement is used for pattern matching. For detailed usage, refer to Pattern Matching:[LIKE](#1-like-运算符).
### 8.2 String Functions
@@ -1152,4 +1152,377 @@ SELECT regexp_like('1a 2b 14m', '^\\d+b$'); -- false
- **Explanation**: Checks if the string `'1a 2b 14m'` matches the pattern `^\\d+b$` exactly.
- `\d+` means "one or more digits".
- `b` represents the letter b.
- - `'1a 2b 14m'` does not match this pattern because it does not start with digits and does not end with `b`, so it returns `false`.
\ No newline at end of file
+ - `'1a 2b 14m'` does not match this pattern because it does not start with digits and does not end with `b`, so it returns `false`.
+
+## 10. Table-Valued Functions
+
+The sample data is as follows:
+
+```SQL
+IoTDB> SELECT * FROM bid;
++-----------------------------+--------+-----+
+| time|stock_id|price|
++-----------------------------+--------+-----+
+|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:15:00.000+08:00| TESL|195.0|
++-----------------------------+--------+-----+
+
+-- Create table statement
+CREATE TABLE bid(time TIMESTAMP TIME, stock_id STRING TAG, price FLOAT FIELD);
+-- Insert data
+INSERT INTO bid(time, stock_id, price) VALUES('2021-01-01T09:05:00','AAPL',100.0),('2021-01-01T09:06:00','TESL',200.0),('2021-01-01T09:07:00','AAPL',103.0),('2021-01-01T09:07:00','TESL',202.0),('2021-01-01T09:09:00','AAPL',102.0),('2021-01-01T09:15:00','TESL',195.0);
+```
+
+### 10.1 HOP
+
+#### 10.1.1 Function Description
+
+The HOP function segments data into overlapping time windows for analysis, assigning each row to all windows that overlap with its timestamp. If windows overlap (when SLIDE < SIZE), data will be duplicated across multiple windows.
+
+#### 10.1.2 Function Definition
+
+```SQL
+HOP(data, timecol, size, slide[, origin])
+```
+
+#### 10.1.3 Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | --------------------------------- | ------------------------- |
+| DATA | Table | ROW SEMANTIC, PASS THROUGH | Input table |
+| TIMECOL | Scalar | String (default: 'time') | Time column |
+| SIZE | Scalar | Long integer | Window size |
+| SLIDE | Scalar | Long integer | Sliding step |
+| ORIGIN | Scalar | Timestamp (default: Unix epoch) | First window start time |
+
+
+#### 10.1.4 Returned Results
+
+The HOP function returns:
+
+* `window_start`: Window start time (inclusive)
+* `window_end`: Window end time (exclusive)
+* Pass-through columns: All input columns from DATA
+
+#### 10.1.5 Usage Example
+
+```SQL
+IoTDB> SELECT * FROM HOP(DATA => bid,TIMECOL => 'time',SLIDE => 5m,SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:25:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY TIME when combined with GROUP BY
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM HOP(DATA => bid,TIMECOL => 'time',SLIDE => 5m,SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:25:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 10.2 SESSION
+
+#### 10.2.1 Function Description
+
+The SESSION function groups data into sessions based on time intervals. It checks the time gap between consecutive rows—rows with gaps smaller than the threshold (GAP) are grouped into the current window, while larger gaps trigger a new window.
+
+#### 10.2.2 Function Definition
+
+```SQL
+SESSION(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], timecol, gap)
+```
+#### 10.2.3 Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | ---------------------------- | -------------------------------------- |
+| DATA | Table | SET SEMANTIC, PASS THROUGH | Input table with partition/sort keys |
+| TIMECOL | Scalar | String (default: 'time') | Time column name |
+| GAP | Scalar | Long integer | Session gap threshold |
+
+#### 10.2.4 Returned Results
+
+The SESSION function returns:
+
+* `window_start`: Time of the first row in the session
+* `window_end`: Time of the last row in the session
+* Pass-through columns: All input columns from DATA
+
+#### 10.2.5 Usage Example
+
+```SQL
+IoTDB> SELECT * FROM SESSION(DATA => bid PARTITION BY stock_id ORDER BY time,TIMECOL => 'time',GAP => 2m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY SESSION when combined with GROUP BY
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM SESSION(DATA => bid PARTITION BY stock_id ORDER BY time,TIMECOL => 'time',GAP => 2m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 10.3 VARIATION
+
+#### 10.3.1 Function Description
+
+The VARIATION function groups data based on value differences. The first row becomes the baseline for the first window. Subsequent rows are compared to the baseline—if the difference is within the threshold (DELTA), they join the current window; otherwise, a new window starts with that row as the new baseline.
+
+#### 10.3.2 Function Definition
+
+```sql
+VARIATION(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], col, delta)
+```
+
+#### 10.3.3 Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | ---------------------------- | -------------------------------------- |
+| DATA | Table | SET SEMANTIC, PASS THROUGH | Input table with partition/sort keys |
+| COL | Scalar | String | Column for difference calculation |
+| DELTA | Scalar | Float | Difference threshold |
+
+#### 10.3.4 Returned Results
+
+The VARIATION function returns:
+
+* `window_index`: Window identifier
+* Pass-through columns: All input columns from DATA
+
+#### 10.3.5 Usage Example
+
+```sql
+IoTDB> SELECT * FROM VARIATION(DATA => bid PARTITION BY stock_id ORDER BY time,COL => 'price',DELTA => 2.0);
++------------+-----------------------------+--------+-----+
+|window_index| time|stock_id|price|
++------------+-----------------------------+--------+-----+
+| 0|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+| 0|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+| 1|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+| 0|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+| 1|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+| 1|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY VARIATION when combined with GROUP BY
+IoTDB> SELECT first(time) as window_start, last(time) as window_end, stock_id, avg(price) as avg FROM VARIATION(DATA => bid PARTITION BY stock_id ORDER BY time,COL => 'price', DELTA => 2.0) GROUP BY window_index, stock_id;
++-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:07:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.5|
++-----------------------------+-----------------------------+--------+-----+
+```
+
+### 10.4 CAPACITY
+
+#### 10.4.1 Function Description
+
+The CAPACITY function groups data into fixed-size windows, where each window contains up to SIZE rows.
+
+#### 10.4.2 Function Definition
+
+```sql
+CAPACITY(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], size)
+```
+
+#### 10.4.3 Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | ---------------------------- | -------------------------------------- |
+| DATA | Table | SET SEMANTIC, PASS THROUGH | Input table with partition/sort keys |
+| SIZE | Scalar | Long integer | Window size (row count) |
+
+#### 10.4.4 Returned Results
+
+The CAPACITY function returns:
+
+* `window_index`: Window identifier
+* Pass-through columns: All input columns from DATA
+
+#### 10.4.5 Usage Example
+
+```sql
+IoTDB> SELECT * FROM CAPACITY(DATA => bid PARTITION BY stock_id ORDER BY time, SIZE => 2);
++------------+-----------------------------+--------+-----+
+|window_index| time|stock_id|price|
++------------+-----------------------------+--------+-----+
+| 0|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+| 0|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+| 1|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+| 0|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+| 0|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+| 1|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY COUNT when combined with GROUP BY
+IoTDB> SELECT first(time) as start_time, last(time) as end_time, stock_id, avg(price) as avg FROM CAPACITY(DATA => bid PARTITION BY stock_id ORDER BY time, SIZE => 2) GROUP BY window_index, stock_id;
++-----------------------------+-----------------------------+--------+-----+
+| start_time| end_time|stock_id| avg|
++-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|101.5|
+|2021-01-01T09:09:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+--------+-----+
+```
+
+### 10.5 TUMBLE
+
+#### 10.5.1 Function Description
+
+The TUMBLE function assigns each row to a non-overlapping, fixed-size time window based on a timestamp attribute.
+
+#### 10.5.2 Function Definition
+
+```sql
+TUMBLE(data, timecol, size[, origin])
+```
+#### 10.5.3 Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | --------------------------------- | ------------------------- |
+| DATA | Table | ROW SEMANTIC, PASS THROUGH | Input table |
+| TIMECOL | Scalar | String (default: 'time') | Time column |
+| SIZE | Scalar | Long integer (positive) | Window size |
+| ORIGIN | Scalar | Timestamp (default: Unix epoch) | First window start time |
+
+#### 10.5.4 Returned Results
+
+The TUMBLE function returns:
+
+* `window_start`: Window start time (inclusive)
+* `window_end`: Window end time (exclusive)
+* Pass-through columns: All input columns from DATA
+
+#### 10.5.5 Usage Example
+
+```SQL
+IoTDB> SELECT * FROM TUMBLE( DATA => bid, TIMECOL => 'time', SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY TIME when combined with GROUP BY
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM TUMBLE(DATA => bid, TIMECOL => 'time', SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 10.6 CUMULATE
+
+#### 10.6.1 Function Description
+
+The CUMULATE function creates expanding windows from an initial window, maintaining the same start time while incrementally extending the end time by STEP until reaching SIZE. Each window contains all elements within its range. For example, with a 1-hour STEP and 24-hour SIZE, daily windows would be: `[00:00, 01:00)`, `[00:00, 02:00)`, ..., `[00:00, 24:00)`.
+
+#### 10.6.2 Function Definition
+
+```sql
+CUMULATE(data, timecol, size, step[, origin])
+```
+
+#### 10.6.3 Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | --------------------------------- | --------------------------------------------------- |
+| DATA | Table | ROW SEMANTIC, PASS THROUGH | Input table |
+| TIMECOL | Scalar | String (default: 'time') | Time column |
+| SIZE | Scalar | Long integer (positive) | Window size (must be an integer multiple of STEP) |
+| STEP | Scalar | Long integer (positive) | Expansion step |
+| ORIGIN | Scalar | Timestamp (default: Unix epoch) | First window start time |
+
+> Note: An error `Cumulative table function requires size must be an integral multiple of step` occurs if SIZE is not divisible by STEP.
+
+#### 10.6.4 Returned Results
+
+The CUMULATE function returns:
+
+* `window_start`: Window start time (inclusive)
+* `window_end`: Window end time (exclusive)
+* Pass-through columns: All input columns from DATA
+
+#### 10.6.5 Usage Example
+
+```sql
+IoTDB> SELECT * FROM CUMULATE(DATA => bid,TIMECOL => 'time',STEP => 2m,SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:16:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:18:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:06:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY TIME when combined with GROUP BY
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM CUMULATE(DATA => bid,TIMECOL => 'time',STEP => 2m, SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:16:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:18:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:06:00.000+08:00| AAPL| 100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00| AAPL| 101.5|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
diff --git a/src/UserGuide/Master/Table/SQL-Manual/Featured-Functions.md b/src/UserGuide/Master/Table/SQL-Manual/Featured-Functions.md
index 5e75c7802..0675560e3 100644
--- a/src/UserGuide/Master/Table/SQL-Manual/Featured-Functions.md
+++ b/src/UserGuide/Master/Table/SQL-Manual/Featured-Functions.md
@@ -319,4 +319,377 @@ WHERE device_id = '100';
|2024-11-26T13:37:00.000+08:00| 90.0| 2.0| 2.0|
|2024-11-26T13:38:00.000+08:00| 90.0| 0.0| 0.0|
+-----------------------------+-----------+-----------+-----------+
-```
\ No newline at end of file
+```
+
+## 3 Table-Valued Functions
+
+The sample data is as follows:
+
+```SQL
+IoTDB> SELECT * FROM bid;
++-----------------------------+--------+-----+
+| time|stock_id|price|
++-----------------------------+--------+-----+
+|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:15:00.000+08:00| TESL|195.0|
++-----------------------------+--------+-----+
+
+-- Create table statement
+CREATE TABLE bid(time TIMESTAMP TIME, stock_id STRING TAG, price FLOAT FIELD);
+-- Insert data
+INSERT INTO bid(time, stock_id, price) VALUES('2021-01-01T09:05:00','AAPL',100.0),('2021-01-01T09:06:00','TESL',200.0),('2021-01-01T09:07:00','AAPL',103.0),('2021-01-01T09:07:00','TESL',202.0),('2021-01-01T09:09:00','AAPL',102.0),('2021-01-01T09:15:00','TESL',195.0);
+```
+
+### 3.1 HOP
+
+#### Function Description
+
+The HOP function segments data into overlapping time windows for analysis, assigning each row to all windows that overlap with its timestamp. If windows overlap (when SLIDE < SIZE), data will be duplicated across multiple windows.
+
+#### Function Definition
+
+```SQL
+HOP(data, timecol, size, slide[, origin])
+```
+
+#### Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | --------------------------------- | ------------------------- |
+| DATA | Table | ROW SEMANTIC, PASS THROUGH | Input table |
+| TIMECOL | Scalar | String (default: 'time') | Time column |
+| SIZE | Scalar | Long integer | Window size |
+| SLIDE | Scalar | Long integer | Sliding step |
+| ORIGIN | Scalar | Timestamp (default: Unix epoch) | First window start time |
+
+
+#### Returned Results
+
+The HOP function returns:
+
+* `window_start`: Window start time (inclusive)
+* `window_end`: Window end time (exclusive)
+* Pass-through columns: All input columns from DATA
+
+#### Usage Example
+
+```SQL
+IoTDB> SELECT * FROM HOP(DATA => bid,TIMECOL => 'time',SLIDE => 5m,SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:25:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY TIME when combined with GROUP BY
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM HOP(DATA => bid,TIMECOL => 'time',SLIDE => 5m,SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:25:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 3.2 SESSION
+
+#### Function Description
+
+The SESSION function groups data into sessions based on time intervals. It checks the time gap between consecutive rows—rows with gaps smaller than the threshold (GAP) are grouped into the current window, while larger gaps trigger a new window.
+
+#### Function Definition
+
+```SQL
+SESSION(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], timecol, gap)
+```
+#### Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | ---------------------------- | -------------------------------------- |
+| DATA | Table | SET SEMANTIC, PASS THROUGH | Input table with partition/sort keys |
+| TIMECOL | Scalar | String (default: 'time') | Time column name |
+| GAP | Scalar | Long integer | Session gap threshold |
+
+#### Returned Results
+
+The SESSION function returns:
+
+* `window_start`: Time of the first row in the session
+* `window_end`: Time of the last row in the session
+* Pass-through columns: All input columns from DATA
+
+#### Usage Example
+
+```SQL
+IoTDB> SELECT * FROM SESSION(DATA => bid PARTITION BY stock_id ORDER BY time,TIMECOL => 'time',GAP => 2m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY SESSION when combined with GROUP BY
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM SESSION(DATA => bid PARTITION BY stock_id ORDER BY time,TIMECOL => 'time',GAP => 2m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 3.3 VARIATION
+
+#### Function Description
+
+The VARIATION function groups data based on value differences. The first row becomes the baseline for the first window. Subsequent rows are compared to the baseline—if the difference is within the threshold (DELTA), they join the current window; otherwise, a new window starts with that row as the new baseline.
+
+#### Function Definition
+
+```sql
+VARIATION(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], col, delta)
+```
+
+#### Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | ---------------------------- | -------------------------------------- |
+| DATA | Table | SET SEMANTIC, PASS THROUGH | Input table with partition/sort keys |
+| COL | Scalar | String | Column for difference calculation |
+| DELTA | Scalar | Float | Difference threshold |
+
+#### Returned Results
+
+The VARIATION function returns:
+
+* `window_index`: Window identifier
+* Pass-through columns: All input columns from DATA
+
+#### Usage Example
+
+```sql
+IoTDB> SELECT * FROM VARIATION(DATA => bid PARTITION BY stock_id ORDER BY time,COL => 'price',DELTA => 2.0);
++------------+-----------------------------+--------+-----+
+|window_index| time|stock_id|price|
++------------+-----------------------------+--------+-----+
+| 0|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+| 0|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+| 1|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+| 0|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+| 1|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+| 1|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY VARIATION when combined with GROUP BY
+IoTDB> SELECT first(time) as window_start, last(time) as window_end, stock_id, avg(price) as avg FROM VARIATION(DATA => bid PARTITION BY stock_id ORDER BY time,COL => 'price', DELTA => 2.0) GROUP BY window_index, stock_id;
++-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:07:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.5|
++-----------------------------+-----------------------------+--------+-----+
+```
+
+### 3.4 CAPACITY
+
+#### Function Description
+
+The CAPACITY function groups data into fixed-size windows, where each window contains up to SIZE rows.
+
+#### Function Definition
+
+```sql
+CAPACITY(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], size)
+```
+
+#### Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | ---------------------------- | -------------------------------------- |
+| DATA | Table | SET SEMANTIC, PASS THROUGH | Input table with partition/sort keys |
+| SIZE | Scalar | Long integer | Window size (row count) |
+
+#### Returned Results
+
+The CAPACITY function returns:
+
+* `window_index`: Window identifier
+* Pass-through columns: All input columns from DATA
+
+#### Usage Example
+
+```sql
+IoTDB> SELECT * FROM CAPACITY(DATA => bid PARTITION BY stock_id ORDER BY time, SIZE => 2);
++------------+-----------------------------+--------+-----+
+|window_index| time|stock_id|price|
++------------+-----------------------------+--------+-----+
+| 0|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+| 0|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+| 1|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+| 0|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+| 0|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+| 1|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY COUNT when combined with GROUP BY
+IoTDB> SELECT first(time) as start_time, last(time) as end_time, stock_id, avg(price) as avg FROM CAPACITY(DATA => bid PARTITION BY stock_id ORDER BY time, SIZE => 2) GROUP BY window_index, stock_id;
++-----------------------------+-----------------------------+--------+-----+
+| start_time| end_time|stock_id| avg|
++-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|101.5|
+|2021-01-01T09:09:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+--------+-----+
+```
+
+### 3.5 TUMBLE
+
+#### Function Description
+
+The TUMBLE function assigns each row to a non-overlapping, fixed-size time window based on a timestamp attribute.
+
+#### Function Definition
+
+```sql
+TUMBLE(data, timecol, size[, origin])
+```
+#### Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | --------------------------------- | ------------------------- |
+| DATA | Table | ROW SEMANTIC, PASS THROUGH | Input table |
+| TIMECOL | Scalar | String (default: 'time') | Time column |
+| SIZE | Scalar | Long integer (positive) | Window size |
+| ORIGIN | Scalar | Timestamp (default: Unix epoch) | First window start time |
+
+#### Returned Results
+
+The TUMBLE function returns:
+
+* `window_start`: Window start time (inclusive)
+* `window_end`: Window end time (exclusive)
+* Pass-through columns: All input columns from DATA
+
+#### Usage Example
+
+```SQL
+IoTDB> SELECT * FROM TUMBLE( DATA => bid, TIMECOL => 'time', SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY TIME when combined with GROUP BY
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM TUMBLE(DATA => bid, TIMECOL => 'time', SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 3.6 CUMULATE
+
+#### Function Description
+
+The CUMULATE function creates expanding windows from an initial window, maintaining the same start time while incrementally extending the end time by STEP until reaching SIZE. Each window contains all elements within its range. For example, with a 1-hour STEP and 24-hour SIZE, daily windows would be: `[00:00, 01:00)`, `[00:00, 02:00)`, ..., `[00:00, 24:00)`.
+
+#### Function Definition
+
+```sql
+CUMULATE(data, timecol, size, step[, origin])
+```
+
+#### Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | --------------------------------- | --------------------------------------------------- |
+| DATA | Table | ROW SEMANTIC, PASS THROUGH | Input table |
+| TIMECOL | Scalar | String (default: 'time') | Time column |
+| SIZE | Scalar | Long integer (positive) | Window size (must be an integer multiple of STEP) |
+| STEP | Scalar | Long integer (positive) | Expansion step |
+| ORIGIN | Scalar | Timestamp (default: Unix epoch) | First window start time |
+
+> Note: An error `Cumulative table function requires size must be an integral multiple of step` occurs if SIZE is not divisible by STEP.
+
+#### Returned Results
+
+The CUMULATE function returns:
+
+* `window_start`: Window start time (inclusive)
+* `window_end`: Window end time (exclusive)
+* Pass-through columns: All input columns from DATA
+
+#### Usage Example
+
+```sql
+IoTDB> SELECT * FROM CUMULATE(DATA => bid,TIMECOL => 'time',STEP => 2m,SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:16:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:18:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:06:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY TIME when combined with GROUP BY
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM CUMULATE(DATA => bid,TIMECOL => 'time',STEP => 2m, SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:16:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:18:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:06:00.000+08:00| AAPL| 100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00| AAPL| 101.5|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
diff --git a/src/UserGuide/Master/Table/User-Manual/User-defined-function.md b/src/UserGuide/Master/Table/User-Manual/User-defined-function.md
index 8190b0648..f7a851cb5 100644
--- a/src/UserGuide/Master/Table/User-Manual/User-defined-function.md
+++ b/src/UserGuide/Master/Table/User-Manual/User-defined-function.md
@@ -25,12 +25,13 @@
UDF refers to user-defined functions. IoTDB offers a variety of built-in time-series processing functions while supporting custom function extensions to fulfill advanced computational needs.
-IoTDB's table model supports two types of UDFs, as detailed below:
+IoTDB's table model supports three types of UDFs, as detailed below:
| UDF Type | Function Type | Description |
|-----------------------------------------|---------------|--------------------------------|
| `UDSF(User-defined Scalar Function)` | Scalar Function | Processes 1 row of k-column data, outputs 1 row of 1-column data (one-to-one mapping). |
| `UDAF(User-defined Aggregate Function)` | Aggregate Function | Processes m rows of k-column data, outputs 1 row of 1-column data (many-to-one reduction). |
+| `UDTF(User-defined Table Function)` | Table-Valued Function | Generates a result set in "table" format based on dynamic input parameters. |
* `UDSF` can be used in any clause or expression where scalar functions are allowed, such as: SELECT clauses, WHERE conditions, etc.
@@ -40,6 +41,8 @@ IoTDB's table model supports two types of UDFs, as detailed below:
* `select udaf1(s1), device_id from table1 group by device_id having udaf2(s1)>0 `
+* `UDTF` Can be used in the FROM clause like a relational table.
+ * `select * from udtf('t1', bid);`
## 2. UDF Management
@@ -345,6 +348,104 @@ Current Fields in `AggregateFunctionAnalysis`:
[UDAF Example](https://github.com/apache/iotdb/blob/master/example/udf/src/main/java/org/apache/iotdb/udf/AggregateFunctionExample.java): Counts non-NULL rows.
-### 3.4 Complete Maven Project Example
+
+### 3.4 UDTF
+
+#### 3.4.1 Definition
+
+A table function, also known as a table-valued function (TVF), differs from scalar functions, aggregate functions, and window functions in that its return value is not a single "scalar value" but rather a "table" (result set).
+
+#### 3.4.2 Usage
+
+Table functions can be used in the `FROM` clause of SQL queries in the form of `tableFunctionCall`, supporting parameter passing and dynamically generating result sets based on the provided arguments.
+
+#### 3.4.3 Syntax
+
+The formal definition of `tableFunctionCall` is as follows:
+
+```sql
+tableFunctionCall
+ : qualifiedName '(' (tableFunctionArgument (',' tableFunctionArgument)*)?')'
+ ;
+
+tableFunctionArgument
+ : (identifier '=>')? (tableArgument | scalarArgument)
+ ;
+
+tableArgument
+ : tableArgumentRelation
+ (PARTITION BY ('(' (expression (',' expression)*)? ')' | expression))?
+ (ORDER BY ('(' sortItem (',' sortItem)* ')' | sortItem))?
+ ;
+
+tableArgumentRelation
+ : qualifiedName (AS? identifier columnAliases?)? #tableArgumentTable
+ | '(' query ')' (AS? identifier columnAliases?)? #tableArgumentQuery
+ ;
+
+scalarArgument
+ : expression
+ | timeDuration
+ ;
+```
+
+Examples:
+
+```SQL
+-- Querying from a table function with a string parameter "t1"
+SELECT * FROM tvf('t1');
+
+-- Querying from a table function with a string parameter "t1" and a table parameter "bid"
+SELECT * FROM tvf('t1', bid);
+```
+
+#### 3.4.4 Function Arguments
+
+IoTDB supports polymorphic table-valued functions with the following argument types:
+
+| Argument Type | Definition | Example |
+|------------------|---------------------------------------------------------------------------| --------------------------------------------------------------------------------------------------------------- |
+| Scalar Argument | Must be a constant expression compatible with the declared SQL data type. | `SIZE => 42`,`SIZE => '42'`,`SIZE => 42.2`,`SIZE => 12h`,`SIZE => 60m` |
+| Table Argument | Can be a table name or a query statement. | `input => orders`,`data => (SELECT * FROM region, nation WHERE region.regionkey = nation.regionkey)` |
+
+Properties of Table Arguments:
+
+1. Set Semantics vs. Row Semantics
+ * Set Semantic: Requires processing an entire partition to produce results.
+ * Allows specifying PARTITION BY or ORDER BY for partition-wise processing.
+
+ ```SQL
+ input => orders PARTITION BY device_id ORDER BY time
+ ```
+
+ * If no PARTITION BY is specified, all data is treated as a single group.
+ * Row Semantics: Rows are processed independently.Does not allow PARTITION BY or ORDER BY—execution is row-by-row.
+
+2. Pass-through Columns
+ * If a table argument is declared with pass-through columns, the function’s result set includes all columns from the input relation.
+ * Example: Window analysis functions can output "original columns + aggregated results + window ID" by enabling pass-through.
+
+#### 3.4.5 Argument Passing Methods
+
+| Method | Description | Example |
+| ------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| ByName | 1. Arguments can be passed in any order.
2. Parameters with default values may be omitted.
3. Case-insensitive parameter names. | `SELECT * FROM my_function(row_count => 100, column_count => 1);` `SELECT * FROM my_function(column_count => 1, row_count => 100);` `SELECT * FROM my_function(column_count => 1);` |
+| ByPosition | 1. Arguments must follow the declared order.
2. Trailing parameters with defaults can be omitted. | `SELECT * FROM my_function(1, 100);` `SELECT * FROM my_function(1);` |
+
+> Note:
+> Mixing named and positional arguments is not allowed and will trigger the error:
+> "All arguments must be passed by name or all must be passed positionally."
+
+#### 3.4.6 Returned Results
+
+The result set of a table function consists of two parts:
+
+1. Proper Columns: Generated by the table function itself.
+2. Pass-through Columns: Automatically included based on table arguments:
+ * If pass-through is enabled: All input relation columns are retained.
+ * If no pass-through but PARTITION BY is specified: Only partition columns are included.
+ * If neither is specified: No additional columns are added.
+
+### 3.5 Complete Maven Project Example
For Maven-based implementations, refer to the sample project: [udf-example](https://github.com/apache/iotdb/tree/master/example/udf).
diff --git a/src/UserGuide/latest-Table/SQL-Manual/Basis-Function.md b/src/UserGuide/latest-Table/SQL-Manual/Basis-Function.md
index 5c97d7435..2a5dfcc2b 100644
--- a/src/UserGuide/latest-Table/SQL-Manual/Basis-Function.md
+++ b/src/UserGuide/latest-Table/SQL-Manual/Basis-Function.md
@@ -1152,4 +1152,377 @@ SELECT regexp_like('1a 2b 14m', '^\\d+b$'); -- false
- **Explanation**: Checks if the string `'1a 2b 14m'` matches the pattern `^\\d+b$` exactly.
- `\d+` means "one or more digits".
- `b` represents the letter b.
- - `'1a 2b 14m'` does not match this pattern because it does not start with digits and does not end with `b`, so it returns `false`.
\ No newline at end of file
+ - `'1a 2b 14m'` does not match this pattern because it does not start with digits and does not end with `b`, so it returns `false`.
+
+## 10. Table-Valued Functions
+
+The sample data is as follows:
+
+```SQL
+IoTDB> SELECT * FROM bid;
++-----------------------------+--------+-----+
+| time|stock_id|price|
++-----------------------------+--------+-----+
+|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:15:00.000+08:00| TESL|195.0|
++-----------------------------+--------+-----+
+
+-- Create table statement
+CREATE TABLE bid(time TIMESTAMP TIME, stock_id STRING TAG, price FLOAT FIELD);
+-- Insert data
+INSERT INTO bid(time, stock_id, price) VALUES('2021-01-01T09:05:00','AAPL',100.0),('2021-01-01T09:06:00','TESL',200.0),('2021-01-01T09:07:00','AAPL',103.0),('2021-01-01T09:07:00','TESL',202.0),('2021-01-01T09:09:00','AAPL',102.0),('2021-01-01T09:15:00','TESL',195.0);
+```
+
+### 10.1 HOP
+
+#### 10.1.1 Function Description
+
+The HOP function segments data into overlapping time windows for analysis, assigning each row to all windows that overlap with its timestamp. If windows overlap (when SLIDE < SIZE), data will be duplicated across multiple windows.
+
+#### 10.1.2 Function Definition
+
+```SQL
+HOP(data, timecol, size, slide[, origin])
+```
+
+#### 10.1.3 Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | --------------------------------- | ------------------------- |
+| DATA | Table | ROW SEMANTIC, PASS THROUGH | Input table |
+| TIMECOL | Scalar | String (default: 'time') | Time column |
+| SIZE | Scalar | Long integer | Window size |
+| SLIDE | Scalar | Long integer | Sliding step |
+| ORIGIN | Scalar | Timestamp (default: Unix epoch) | First window start time |
+
+
+#### 10.1.4 Returned Results
+
+The HOP function returns:
+
+* `window_start`: Window start time (inclusive)
+* `window_end`: Window end time (exclusive)
+* Pass-through columns: All input columns from DATA
+
+#### 10.1.5 Usage Example
+
+```SQL
+IoTDB> SELECT * FROM HOP(DATA => bid,TIMECOL => 'time',SLIDE => 5m,SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:25:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY TIME when combined with GROUP BY
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM HOP(DATA => bid,TIMECOL => 'time',SLIDE => 5m,SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:25:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 10.2 SESSION
+
+#### 10.2.1 Function Description
+
+The SESSION function groups data into sessions based on time intervals. It checks the time gap between consecutive rows—rows with gaps smaller than the threshold (GAP) are grouped into the current window, while larger gaps trigger a new window.
+
+#### 10.2.2 Function Definition
+
+```SQL
+SESSION(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], timecol, gap)
+```
+#### 10.2.3 Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | ---------------------------- | -------------------------------------- |
+| DATA | Table | SET SEMANTIC, PASS THROUGH | Input table with partition/sort keys |
+| TIMECOL | Scalar | String (default: 'time') | Time column name |
+| GAP | Scalar | Long integer | Session gap threshold |
+
+#### 10.2.4 Returned Results
+
+The SESSION function returns:
+
+* `window_start`: Time of the first row in the session
+* `window_end`: Time of the last row in the session
+* Pass-through columns: All input columns from DATA
+
+#### 10.2.5 Usage Example
+
+```SQL
+IoTDB> SELECT * FROM SESSION(DATA => bid PARTITION BY stock_id ORDER BY time,TIMECOL => 'time',GAP => 2m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY SESSION when combined with GROUP BY
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM SESSION(DATA => bid PARTITION BY stock_id ORDER BY time,TIMECOL => 'time',GAP => 2m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 10.3 VARIATION
+
+#### 10.3.1 Function Description
+
+The VARIATION function groups data based on value differences. The first row becomes the baseline for the first window. Subsequent rows are compared to the baseline—if the difference is within the threshold (DELTA), they join the current window; otherwise, a new window starts with that row as the new baseline.
+
+#### 10.3.2 Function Definition
+
+```sql
+VARIATION(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], col, delta)
+```
+
+#### 10.3.3 Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | ---------------------------- | -------------------------------------- |
+| DATA | Table | SET SEMANTIC, PASS THROUGH | Input table with partition/sort keys |
+| COL | Scalar | String | Column for difference calculation |
+| DELTA | Scalar | Float | Difference threshold |
+
+#### 10.3.4 Returned Results
+
+The VARIATION function returns:
+
+* `window_index`: Window identifier
+* Pass-through columns: All input columns from DATA
+
+#### 10.3.5 Usage Example
+
+```sql
+IoTDB> SELECT * FROM VARIATION(DATA => bid PARTITION BY stock_id ORDER BY time,COL => 'price',DELTA => 2.0);
++------------+-----------------------------+--------+-----+
+|window_index| time|stock_id|price|
++------------+-----------------------------+--------+-----+
+| 0|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+| 0|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+| 1|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+| 0|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+| 1|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+| 1|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY VARIATION when combined with GROUP BY
+IoTDB> SELECT first(time) as window_start, last(time) as window_end, stock_id, avg(price) as avg FROM VARIATION(DATA => bid PARTITION BY stock_id ORDER BY time,COL => 'price', DELTA => 2.0) GROUP BY window_index, stock_id;
++-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:07:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.5|
++-----------------------------+-----------------------------+--------+-----+
+```
+
+### 10.4 CAPACITY
+
+#### 10.4.1 Function Description
+
+The CAPACITY function groups data into fixed-size windows, where each window contains up to SIZE rows.
+
+#### 10.4.2 Function Definition
+
+```sql
+CAPACITY(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], size)
+```
+
+#### 10.4.3 Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | ---------------------------- | -------------------------------------- |
+| DATA | Table | SET SEMANTIC, PASS THROUGH | Input table with partition/sort keys |
+| SIZE | Scalar | Long integer | Window size (row count) |
+
+#### 10.4.4 Returned Results
+
+The CAPACITY function returns:
+
+* `window_index`: Window identifier
+* Pass-through columns: All input columns from DATA
+
+#### 10.4.5 Usage Example
+
+```sql
+IoTDB> SELECT * FROM CAPACITY(DATA => bid PARTITION BY stock_id ORDER BY time, SIZE => 2);
++------------+-----------------------------+--------+-----+
+|window_index| time|stock_id|price|
++------------+-----------------------------+--------+-----+
+| 0|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+| 0|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+| 1|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+| 0|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+| 0|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+| 1|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY COUNT when combined with GROUP BY
+IoTDB> SELECT first(time) as start_time, last(time) as end_time, stock_id, avg(price) as avg FROM CAPACITY(DATA => bid PARTITION BY stock_id ORDER BY time, SIZE => 2) GROUP BY window_index, stock_id;
++-----------------------------+-----------------------------+--------+-----+
+| start_time| end_time|stock_id| avg|
++-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|101.5|
+|2021-01-01T09:09:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+--------+-----+
+```
+
+### 10.5 TUMBLE
+
+#### 10.5.1 Function Description
+
+The TUMBLE function assigns each row to a non-overlapping, fixed-size time window based on a timestamp attribute.
+
+#### 10.5.2 Function Definition
+
+```sql
+TUMBLE(data, timecol, size[, origin])
+```
+#### 10.5.3 Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | --------------------------------- | ------------------------- |
+| DATA | Table | ROW SEMANTIC, PASS THROUGH | Input table |
+| TIMECOL | Scalar | String (default: 'time') | Time column |
+| SIZE | Scalar | Long integer (positive) | Window size |
+| ORIGIN | Scalar | Timestamp (default: Unix epoch) | First window start time |
+
+#### 10.5.4 Returned Results
+
+The TUMBLE function returns:
+
+* `window_start`: Window start time (inclusive)
+* `window_end`: Window end time (exclusive)
+* Pass-through columns: All input columns from DATA
+
+#### 10.5.5 Usage Example
+
+```SQL
+IoTDB> SELECT * FROM TUMBLE( DATA => bid, TIMECOL => 'time', SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY TIME when combined with GROUP BY
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM TUMBLE(DATA => bid, TIMECOL => 'time', SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 10.6 CUMULATE
+
+#### 10.6.1 Function Description
+
+The CUMULATE function creates expanding windows from an initial window, maintaining the same start time while incrementally extending the end time by STEP until reaching SIZE. Each window contains all elements within its range. For example, with a 1-hour STEP and 24-hour SIZE, daily windows would be: `[00:00, 01:00)`, `[00:00, 02:00)`, ..., `[00:00, 24:00)`.
+
+#### 10.6.2 Function Definition
+
+```sql
+CUMULATE(data, timecol, size, step[, origin])
+```
+
+#### 10.6.3 Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | --------------------------------- | --------------------------------------------------- |
+| DATA | Table | ROW SEMANTIC, PASS THROUGH | Input table |
+| TIMECOL | Scalar | String (default: 'time') | Time column |
+| SIZE | Scalar | Long integer (positive) | Window size (must be an integer multiple of STEP) |
+| STEP | Scalar | Long integer (positive) | Expansion step |
+| ORIGIN | Scalar | Timestamp (default: Unix epoch) | First window start time |
+
+> Note: An error `Cumulative table function requires size must be an integral multiple of step` occurs if SIZE is not divisible by STEP.
+
+#### 10.6.4 Returned Results
+
+The CUMULATE function returns:
+
+* `window_start`: Window start time (inclusive)
+* `window_end`: Window end time (exclusive)
+* Pass-through columns: All input columns from DATA
+
+#### 10.6.5 Usage Example
+
+```sql
+IoTDB> SELECT * FROM CUMULATE(DATA => bid,TIMECOL => 'time',STEP => 2m,SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:16:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:18:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:06:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY TIME when combined with GROUP BY
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM CUMULATE(DATA => bid,TIMECOL => 'time',STEP => 2m, SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:16:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:18:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:06:00.000+08:00| AAPL| 100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00| AAPL| 101.5|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
diff --git a/src/UserGuide/latest-Table/SQL-Manual/Featured-Functions.md b/src/UserGuide/latest-Table/SQL-Manual/Featured-Functions.md
index 5e75c7802..0675560e3 100644
--- a/src/UserGuide/latest-Table/SQL-Manual/Featured-Functions.md
+++ b/src/UserGuide/latest-Table/SQL-Manual/Featured-Functions.md
@@ -319,4 +319,377 @@ WHERE device_id = '100';
|2024-11-26T13:37:00.000+08:00| 90.0| 2.0| 2.0|
|2024-11-26T13:38:00.000+08:00| 90.0| 0.0| 0.0|
+-----------------------------+-----------+-----------+-----------+
-```
\ No newline at end of file
+```
+
+## 3 Table-Valued Functions
+
+The sample data is as follows:
+
+```SQL
+IoTDB> SELECT * FROM bid;
++-----------------------------+--------+-----+
+| time|stock_id|price|
++-----------------------------+--------+-----+
+|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:15:00.000+08:00| TESL|195.0|
++-----------------------------+--------+-----+
+
+-- Create table statement
+CREATE TABLE bid(time TIMESTAMP TIME, stock_id STRING TAG, price FLOAT FIELD);
+-- Insert data
+INSERT INTO bid(time, stock_id, price) VALUES('2021-01-01T09:05:00','AAPL',100.0),('2021-01-01T09:06:00','TESL',200.0),('2021-01-01T09:07:00','AAPL',103.0),('2021-01-01T09:07:00','TESL',202.0),('2021-01-01T09:09:00','AAPL',102.0),('2021-01-01T09:15:00','TESL',195.0);
+```
+
+### 3.1 HOP
+
+#### Function Description
+
+The HOP function segments data into overlapping time windows for analysis, assigning each row to all windows that overlap with its timestamp. If windows overlap (when SLIDE < SIZE), data will be duplicated across multiple windows.
+
+#### Function Definition
+
+```SQL
+HOP(data, timecol, size, slide[, origin])
+```
+
+#### Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | --------------------------------- | ------------------------- |
+| DATA | Table | ROW SEMANTIC, PASS THROUGH | Input table |
+| TIMECOL | Scalar | String (default: 'time') | Time column |
+| SIZE | Scalar | Long integer | Window size |
+| SLIDE | Scalar | Long integer | Sliding step |
+| ORIGIN | Scalar | Timestamp (default: Unix epoch) | First window start time |
+
+
+#### Returned Results
+
+The HOP function returns:
+
+* `window_start`: Window start time (inclusive)
+* `window_end`: Window end time (exclusive)
+* Pass-through columns: All input columns from DATA
+
+#### Usage Example
+
+```SQL
+IoTDB> SELECT * FROM HOP(DATA => bid,TIMECOL => 'time',SLIDE => 5m,SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:25:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY TIME when combined with GROUP BY
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM HOP(DATA => bid,TIMECOL => 'time',SLIDE => 5m,SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:25:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 3.2 SESSION
+
+#### Function Description
+
+The SESSION function groups data into sessions based on time intervals. It checks the time gap between consecutive rows—rows with gaps smaller than the threshold (GAP) are grouped into the current window, while larger gaps trigger a new window.
+
+#### Function Definition
+
+```SQL
+SESSION(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], timecol, gap)
+```
+#### Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | ---------------------------- | -------------------------------------- |
+| DATA | Table | SET SEMANTIC, PASS THROUGH | Input table with partition/sort keys |
+| TIMECOL | Scalar | String (default: 'time') | Time column name |
+| GAP | Scalar | Long integer | Session gap threshold |
+
+#### Returned Results
+
+The SESSION function returns:
+
+* `window_start`: Time of the first row in the session
+* `window_end`: Time of the last row in the session
+* Pass-through columns: All input columns from DATA
+
+#### Usage Example
+
+```SQL
+IoTDB> SELECT * FROM SESSION(DATA => bid PARTITION BY stock_id ORDER BY time,TIMECOL => 'time',GAP => 2m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY SESSION when combined with GROUP BY
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM SESSION(DATA => bid PARTITION BY stock_id ORDER BY time,TIMECOL => 'time',GAP => 2m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 3.3 VARIATION
+
+#### Function Description
+
+The VARIATION function groups data based on value differences. The first row becomes the baseline for the first window. Subsequent rows are compared to the baseline—if the difference is within the threshold (DELTA), they join the current window; otherwise, a new window starts with that row as the new baseline.
+
+#### Function Definition
+
+```sql
+VARIATION(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], col, delta)
+```
+
+#### Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | ---------------------------- | -------------------------------------- |
+| DATA | Table | SET SEMANTIC, PASS THROUGH | Input table with partition/sort keys |
+| COL | Scalar | String | Column for difference calculation |
+| DELTA | Scalar | Float | Difference threshold |
+
+#### Returned Results
+
+The VARIATION function returns:
+
+* `window_index`: Window identifier
+* Pass-through columns: All input columns from DATA
+
+#### Usage Example
+
+```sql
+IoTDB> SELECT * FROM VARIATION(DATA => bid PARTITION BY stock_id ORDER BY time,COL => 'price',DELTA => 2.0);
++------------+-----------------------------+--------+-----+
+|window_index| time|stock_id|price|
++------------+-----------------------------+--------+-----+
+| 0|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+| 0|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+| 1|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+| 0|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+| 1|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+| 1|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY VARIATION when combined with GROUP BY
+IoTDB> SELECT first(time) as window_start, last(time) as window_end, stock_id, avg(price) as avg FROM VARIATION(DATA => bid PARTITION BY stock_id ORDER BY time,COL => 'price', DELTA => 2.0) GROUP BY window_index, stock_id;
++-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:07:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.5|
++-----------------------------+-----------------------------+--------+-----+
+```
+
+### 3.4 CAPACITY
+
+#### Function Description
+
+The CAPACITY function groups data into fixed-size windows, where each window contains up to SIZE rows.
+
+#### Function Definition
+
+```sql
+CAPACITY(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], size)
+```
+
+#### Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | ---------------------------- | -------------------------------------- |
+| DATA | Table | SET SEMANTIC, PASS THROUGH | Input table with partition/sort keys |
+| SIZE | Scalar | Long integer | Window size (row count) |
+
+#### Returned Results
+
+The CAPACITY function returns:
+
+* `window_index`: Window identifier
+* Pass-through columns: All input columns from DATA
+
+#### Usage Example
+
+```sql
+IoTDB> SELECT * FROM CAPACITY(DATA => bid PARTITION BY stock_id ORDER BY time, SIZE => 2);
++------------+-----------------------------+--------+-----+
+|window_index| time|stock_id|price|
++------------+-----------------------------+--------+-----+
+| 0|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+| 0|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+| 1|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+| 0|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+| 0|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+| 1|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY COUNT when combined with GROUP BY
+IoTDB> SELECT first(time) as start_time, last(time) as end_time, stock_id, avg(price) as avg FROM CAPACITY(DATA => bid PARTITION BY stock_id ORDER BY time, SIZE => 2) GROUP BY window_index, stock_id;
++-----------------------------+-----------------------------+--------+-----+
+| start_time| end_time|stock_id| avg|
++-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|101.5|
+|2021-01-01T09:09:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+--------+-----+
+```
+
+### 3.5 TUMBLE
+
+#### Function Description
+
+The TUMBLE function assigns each row to a non-overlapping, fixed-size time window based on a timestamp attribute.
+
+#### Function Definition
+
+```sql
+TUMBLE(data, timecol, size[, origin])
+```
+#### Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | --------------------------------- | ------------------------- |
+| DATA | Table | ROW SEMANTIC, PASS THROUGH | Input table |
+| TIMECOL | Scalar | String (default: 'time') | Time column |
+| SIZE | Scalar | Long integer (positive) | Window size |
+| ORIGIN | Scalar | Timestamp (default: Unix epoch) | First window start time |
+
+#### Returned Results
+
+The TUMBLE function returns:
+
+* `window_start`: Window start time (inclusive)
+* `window_end`: Window end time (exclusive)
+* Pass-through columns: All input columns from DATA
+
+#### Usage Example
+
+```SQL
+IoTDB> SELECT * FROM TUMBLE( DATA => bid, TIMECOL => 'time', SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY TIME when combined with GROUP BY
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM TUMBLE(DATA => bid, TIMECOL => 'time', SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 3.6 CUMULATE
+
+#### Function Description
+
+The CUMULATE function creates expanding windows from an initial window, maintaining the same start time while incrementally extending the end time by STEP until reaching SIZE. Each window contains all elements within its range. For example, with a 1-hour STEP and 24-hour SIZE, daily windows would be: `[00:00, 01:00)`, `[00:00, 02:00)`, ..., `[00:00, 24:00)`.
+
+#### Function Definition
+
+```sql
+CUMULATE(data, timecol, size, step[, origin])
+```
+
+#### Parameter Description
+
+| Parameter | Type | Attributes | Description |
+| ----------- | -------- | --------------------------------- | --------------------------------------------------- |
+| DATA | Table | ROW SEMANTIC, PASS THROUGH | Input table |
+| TIMECOL | Scalar | String (default: 'time') | Time column |
+| SIZE | Scalar | Long integer (positive) | Window size (must be an integer multiple of STEP) |
+| STEP | Scalar | Long integer (positive) | Expansion step |
+| ORIGIN | Scalar | Timestamp (default: Unix epoch) | First window start time |
+
+> Note: An error `Cumulative table function requires size must be an integral multiple of step` occurs if SIZE is not divisible by STEP.
+
+#### Returned Results
+
+The CUMULATE function returns:
+
+* `window_start`: Window start time (inclusive)
+* `window_end`: Window end time (exclusive)
+* Pass-through columns: All input columns from DATA
+
+#### Usage Example
+
+```sql
+IoTDB> SELECT * FROM CUMULATE(DATA => bid,TIMECOL => 'time',STEP => 2m,SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:16:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:18:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:06:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- Equivalent to tree model's GROUP BY TIME when combined with GROUP BY
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM CUMULATE(DATA => bid,TIMECOL => 'time',STEP => 2m, SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:16:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:18:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:06:00.000+08:00| AAPL| 100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00| AAPL| 101.5|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
diff --git a/src/UserGuide/latest-Table/User-Manual/User-defined-function.md b/src/UserGuide/latest-Table/User-Manual/User-defined-function.md
index 8190b0648..f7a851cb5 100644
--- a/src/UserGuide/latest-Table/User-Manual/User-defined-function.md
+++ b/src/UserGuide/latest-Table/User-Manual/User-defined-function.md
@@ -25,12 +25,13 @@
UDF refers to user-defined functions. IoTDB offers a variety of built-in time-series processing functions while supporting custom function extensions to fulfill advanced computational needs.
-IoTDB's table model supports two types of UDFs, as detailed below:
+IoTDB's table model supports three types of UDFs, as detailed below:
| UDF Type | Function Type | Description |
|-----------------------------------------|---------------|--------------------------------|
| `UDSF(User-defined Scalar Function)` | Scalar Function | Processes 1 row of k-column data, outputs 1 row of 1-column data (one-to-one mapping). |
| `UDAF(User-defined Aggregate Function)` | Aggregate Function | Processes m rows of k-column data, outputs 1 row of 1-column data (many-to-one reduction). |
+| `UDTF(User-defined Table Function)` | Table-Valued Function | Generates a result set in "table" format based on dynamic input parameters. |
* `UDSF` can be used in any clause or expression where scalar functions are allowed, such as: SELECT clauses, WHERE conditions, etc.
@@ -40,6 +41,8 @@ IoTDB's table model supports two types of UDFs, as detailed below:
* `select udaf1(s1), device_id from table1 group by device_id having udaf2(s1)>0 `
+* `UDTF` Can be used in the FROM clause like a relational table.
+ * `select * from udtf('t1', bid);`
## 2. UDF Management
@@ -345,6 +348,104 @@ Current Fields in `AggregateFunctionAnalysis`:
[UDAF Example](https://github.com/apache/iotdb/blob/master/example/udf/src/main/java/org/apache/iotdb/udf/AggregateFunctionExample.java): Counts non-NULL rows.
-### 3.4 Complete Maven Project Example
+
+### 3.4 UDTF
+
+#### 3.4.1 Definition
+
+A table function, also known as a table-valued function (TVF), differs from scalar functions, aggregate functions, and window functions in that its return value is not a single "scalar value" but rather a "table" (result set).
+
+#### 3.4.2 Usage
+
+Table functions can be used in the `FROM` clause of SQL queries in the form of `tableFunctionCall`, supporting parameter passing and dynamically generating result sets based on the provided arguments.
+
+#### 3.4.3 Syntax
+
+The formal definition of `tableFunctionCall` is as follows:
+
+```sql
+tableFunctionCall
+ : qualifiedName '(' (tableFunctionArgument (',' tableFunctionArgument)*)?')'
+ ;
+
+tableFunctionArgument
+ : (identifier '=>')? (tableArgument | scalarArgument)
+ ;
+
+tableArgument
+ : tableArgumentRelation
+ (PARTITION BY ('(' (expression (',' expression)*)? ')' | expression))?
+ (ORDER BY ('(' sortItem (',' sortItem)* ')' | sortItem))?
+ ;
+
+tableArgumentRelation
+ : qualifiedName (AS? identifier columnAliases?)? #tableArgumentTable
+ | '(' query ')' (AS? identifier columnAliases?)? #tableArgumentQuery
+ ;
+
+scalarArgument
+ : expression
+ | timeDuration
+ ;
+```
+
+Examples:
+
+```SQL
+-- Querying from a table function with a string parameter "t1"
+SELECT * FROM tvf('t1');
+
+-- Querying from a table function with a string parameter "t1" and a table parameter "bid"
+SELECT * FROM tvf('t1', bid);
+```
+
+#### 3.4.4 Function Arguments
+
+IoTDB supports polymorphic table-valued functions with the following argument types:
+
+| Argument Type | Definition | Example |
+|------------------|---------------------------------------------------------------------------| --------------------------------------------------------------------------------------------------------------- |
+| Scalar Argument | Must be a constant expression compatible with the declared SQL data type. | `SIZE => 42`,`SIZE => '42'`,`SIZE => 42.2`,`SIZE => 12h`,`SIZE => 60m` |
+| Table Argument | Can be a table name or a query statement. | `input => orders`,`data => (SELECT * FROM region, nation WHERE region.regionkey = nation.regionkey)` |
+
+Properties of Table Arguments:
+
+1. Set Semantics vs. Row Semantics
+ * Set Semantic: Requires processing an entire partition to produce results.
+ * Allows specifying PARTITION BY or ORDER BY for partition-wise processing.
+
+ ```SQL
+ input => orders PARTITION BY device_id ORDER BY time
+ ```
+
+ * If no PARTITION BY is specified, all data is treated as a single group.
+ * Row Semantics: Rows are processed independently.Does not allow PARTITION BY or ORDER BY—execution is row-by-row.
+
+2. Pass-through Columns
+ * If a table argument is declared with pass-through columns, the function’s result set includes all columns from the input relation.
+ * Example: Window analysis functions can output "original columns + aggregated results + window ID" by enabling pass-through.
+
+#### 3.4.5 Argument Passing Methods
+
+| Method | Description | Example |
+| ------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| ByName | 1. Arguments can be passed in any order.
2. Parameters with default values may be omitted.
3. Case-insensitive parameter names. | `SELECT * FROM my_function(row_count => 100, column_count => 1);` `SELECT * FROM my_function(column_count => 1, row_count => 100);` `SELECT * FROM my_function(column_count => 1);` |
+| ByPosition | 1. Arguments must follow the declared order.
2. Trailing parameters with defaults can be omitted. | `SELECT * FROM my_function(1, 100);` `SELECT * FROM my_function(1);` |
+
+> Note:
+> Mixing named and positional arguments is not allowed and will trigger the error:
+> "All arguments must be passed by name or all must be passed positionally."
+
+#### 3.4.6 Returned Results
+
+The result set of a table function consists of two parts:
+
+1. Proper Columns: Generated by the table function itself.
+2. Pass-through Columns: Automatically included based on table arguments:
+ * If pass-through is enabled: All input relation columns are retained.
+ * If no pass-through but PARTITION BY is specified: Only partition columns are included.
+ * If neither is specified: No additional columns are added.
+
+### 3.5 Complete Maven Project Example
For Maven-based implementations, refer to the sample project: [udf-example](https://github.com/apache/iotdb/tree/master/example/udf).
diff --git a/src/zh/UserGuide/Master/Table/SQL-Manual/Basis-Function.md b/src/zh/UserGuide/Master/Table/SQL-Manual/Basis-Function.md
index 62ad12638..33ca019b8 100644
--- a/src/zh/UserGuide/Master/Table/SQL-Manual/Basis-Function.md
+++ b/src/zh/UserGuide/Master/Table/SQL-Manual/Basis-Function.md
@@ -144,7 +144,7 @@ SELECT GREATEST(temperature,humidity) FROM table2;
-- 查询 table2 中 temperature 和 humidity 的最小记录
SELECT LEAST(temperature,humidity) FROM table2;
```
-
+
## 2. 聚合函数
@@ -153,7 +153,7 @@ SELECT LEAST(temperature,humidity) FROM table2;
1. 聚合函数是多对一函数。它们对一组值进行聚合计算,得到单个聚合结果。
2. 除了 `COUNT()`之外,其他所有聚合函数都忽略空值,并在没有输入行或所有值为空时返回空值。 例如,`SUM()` 返回 null 而不是零,而 `AVG()` 在计数中不包括 null 值。
-### 2.2 支持的聚合函数
+### 2.2 支持的聚合函数
| 函数名 | 功能描述 | 允许的输入类型 | 输出类型 |
| ----------- | ------------------------------------------------------------ |-----------------------------------------------|------------------|
@@ -350,7 +350,6 @@ It costs 0.244s
```
-
## 3. 逻辑运算符
### 3.1 概述
@@ -1152,4 +1151,377 @@ SELECT regexp_like('1a 2b 14m', '^\\d+b$'); -- false
- **说明**:检查字符串 `'1a 2b 14m'` 是否完全匹配模式 `^\\d+b$`。
- `\d+` 表示“一个或多个数字”。
- `b` 表示字母 `b`。
- - `'1a 2b 14m'` 并不符合这个模式,因为它不是从数字开始,也不是以 `b` 结束,所以返回 `false`。
\ No newline at end of file
+ - `'1a 2b 14m'` 并不符合这个模式,因为它不是从数字开始,也不是以 `b` 结束,所以返回 `false`。
+
+## 10. 表值函数
+
+原始示例数据如下:
+
+```SQL
+IoTDB> SELECT * FROM bid;
++-----------------------------+--------+-----+
+| time|stock_id|price|
++-----------------------------+--------+-----+
+|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:15:00.000+08:00| TESL|195.0|
++-----------------------------+--------+-----+
+
+-- 创建语句
+CREATE TABLE bid(time TIMESTAMP TIME, stock_id STRING TAG, price FLOAT FIELD);
+-- 插入数据
+INSERT INTO bid(time, stock_id, price) VALUES('2021-01-01T09:05:00','AAPL',100.0),('2021-01-01T09:06:00','TESL',200.0),('2021-01-01T09:07:00','AAPL',103.0),('2021-01-01T09:07:00','TESL',202.0),('2021-01-01T09:09:00','AAPL',102.0),('2021-01-01T09:15:00','TESL',195.0);
+```
+
+### 10.1 HOP
+
+#### 10.1.1 功能描述
+
+HOP 函数用于按时间分段分窗分析,识别每一行数据所属的时间窗口。该函数通过指定固定窗口大小(size)和窗口滑动步长(SLIDE),将数据按时间戳分配到所有与其时间戳重叠的窗口中。若窗口之间存在重叠(步长 < 窗口大小),数据会自动复制到多个窗口。
+
+#### 10.1.2 函数定义
+
+```SQL
+HOP(data, timecol, size, slide[, origin])
+```
+
+#### 10.1.3 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| --------- | ---------- | --------------------------------- | -------------------- |
+| DATA | 表参数 | ROW SEMANTICPASS THROUGH | 输入表 |
+| TIMECOL | 标量参数 | 字符串类型默认值:time | 时间列 |
+| SIZE | 标量参数 | 长整数类型 | 窗口大小 |
+| SLIDE | 标量参数 | 长整数类型 | 窗口滑动步长 |
+| ORIGIN | 标量参数 | 时间戳类型默认值:Unix 纪元时间 | 第一个窗口起始时间 |
+
+#### 10.1.4 返回结果
+
+HOP 函数的返回结果列包含:
+
+* window\_start: 窗口开始时间(闭区间)
+* window\_end: 窗口结束时间(开区间)
+* 映射列:DATA 参数的所有输入列
+
+#### 10.1.5 使用示例
+
+```SQL
+IoTDB> SELECT * FROM HOP(DATA => bid,TIMECOL => 'time',SLIDE => 5m,SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:25:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY TIME
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM HOP(DATA => bid,TIMECOL => 'time',SLIDE => 5m,SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:25:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 10.2 SESSION
+
+#### 10.2.1 功能描述
+
+SESSION 函数用于按会话间隔对数据进行分窗。系统逐行检查与前一行的时间间隔,小于阈值(GAP)则归入当前窗口,超过则归入下一个窗口。
+
+#### 10.2.2 函数定义
+
+```SQL
+SESSION(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], timecol, gap)
+```
+#### 10.2.3 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| --------- | ---------- | -------------------------- | ---------------------------------------- |
+| DATA | 表参数 | SET SEMANTICPASS THROUGH | 输入表通过 pkeys、okeys 指定分区和排序 |
+| TIMECOL | 标量参数 | 字符串类型默认值:'time' | 时间列名
+|
+| GAP | 标量参数 | 长整数类型 | 会话间隔阈值 |
+
+#### 10.2.4 返回结果
+
+SESSION 函数的返回结果列包含:
+
+* window\_start: 会话窗口内的第一条数据的时间
+* window\_end: 会话窗口内的最后一条数据的时间
+* 映射列:DATA 参数的所有输入列
+
+#### 10.2.5 使用示例
+
+```SQL
+IoTDB> SELECT * FROM SESSION(DATA => bid PARTITION BY stock_id ORDER BY time,TIMECOL => 'time',GAP => 2m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY SESSION
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM SESSION(DATA => bid PARTITION BY stock_id ORDER BY time,TIMECOL => 'time',GAP => 2m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 10.3 VARIATION
+
+#### 10.3.1 功能描述
+
+VARIATION 函数用于按数据差值分窗,将第一条数据作为首个窗口的基准值,每个数据点会与基准值进行差值运算,如果差值小于给定的阈值(delta)则加入当前窗口;如果超过阈值,则分为下一个窗口,将该值作为下一个窗口的基准值。
+
+#### 10.3.2 函数定义
+
+```sql
+VARIATION(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], col, delta)
+```
+
+#### 10.3.3 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| -------- | ---------- | -------------------------- | ---------------------------------------- |
+| DATA | 表参数 | SET SEMANTICPASS THROUGH | 输入表通过 pkeys、okeys 指定分区和排序 |
+| COL | 标量参数 | 字符串类型 | 标识对哪一列计算差值 |
+| DELTA | 标量参数 | 浮点数类型 | 差值阈值 |
+
+#### 10.3.4 返回结果
+
+VARIATION 函数的返回结果列包含:
+
+* window\_index: 窗口编号
+* 映射列:DATA 参数的所有输入列
+
+#### 10.3.5 使用示例
+
+```sql
+IoTDB> SELECT * FROM VARIATION(DATA => bid PARTITION BY stock_id ORDER BY time,COL => 'price',DELTA => 2.0);
++------------+-----------------------------+--------+-----+
+|window_index| time|stock_id|price|
++------------+-----------------------------+--------+-----+
+| 0|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+| 0|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+| 1|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+| 0|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+| 1|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+| 1|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY VARIATION
+IoTDB> SELECT first(time) as window_start, last(time) as window_end, stock_id, avg(price) as avg FROM VARIATION(DATA => bid PARTITION BY stock_id ORDER BY time,COL => 'price', DELTA => 2.0) GROUP BY window_index, stock_id;
++-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:07:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.5|
++-----------------------------+-----------------------------+--------+-----+
+```
+
+### 10.4 CAPACITY
+
+#### 10.4.1 功能描述
+
+CAPACITY 函数用于按数据点数(行数)分窗,每个窗口最多有 SIZE 行数据。
+
+#### 10.4.2 函数定义
+
+```sql
+CAPACITY(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], size)
+```
+
+#### 10.4.3 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| -------- | ---------- | -------------------------- | ---------------------------------------- |
+| DATA | 表参数 | SET SEMANTICPASS THROUGH | 输入表通过 pkeys、okeys 指定分区和排序 |
+| SIZE | 标量参数 | 长整数类型 | 窗口大小 |
+
+#### 10.4.4 返回结果
+
+CAPACITY 函数的返回结果列包含:
+
+* window\_index: 窗口编号
+* 映射列:DATA 参数的所有输入列
+
+#### 10.4.5 使用示例
+
+```sql
+IoTDB> SELECT * FROM CAPACITY(DATA => bid PARTITION BY stock_id ORDER BY time, SIZE => 2);
++------------+-----------------------------+--------+-----+
+|window_index| time|stock_id|price|
++------------+-----------------------------+--------+-----+
+| 0|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+| 0|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+| 1|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+| 0|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+| 0|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+| 1|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY COUNT
+IoTDB> SELECT first(time) as start_time, last(time) as end_time, stock_id, avg(price) as avg FROM CAPACITY(DATA => bid PARTITION BY stock_id ORDER BY time, SIZE => 2) GROUP BY window_index, stock_id;
++-----------------------------+-----------------------------+--------+-----+
+| start_time| end_time|stock_id| avg|
++-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|101.5|
+|2021-01-01T09:09:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+--------+-----+
+```
+
+### 10.5 TUMBLE
+
+#### 10.5.1 功能描述
+
+TUMBLE 函数用于通过时间属性字段为每行数据分配一个窗口,滚动窗口的大小固定且不重复。
+
+#### 10.5.2 函数定义
+
+```sql
+TUMBLE(data, timecol, size[, origin])
+```
+#### 10.5.3 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| --------- | ---------- | --------------------------------- | -------------------- |
+| DATA | 表参数 | ROW SEMANTICPASS THROUGH | 输入表 |
+| TIMECOL | 标量参数 | 字符串类型默认值:time | 时间列 |
+| SIZE | 标量参数 | 长整数类型 | 窗口大小,需为正数 |
+| ORIGIN | 标量参数 | 时间戳类型默认值:Unix 纪元时间 | 第一个窗口起始时间 |
+
+#### 10.5.4 返回结果
+
+TUBMLE 函数的返回结果列包含:
+
+* window\_start: 窗口开始时间(闭区间)
+* window\_end: 窗口结束时间(开区间)
+* 映射列:DATA 参数的所有输入列
+
+#### 10.5.5 使用示例
+
+```SQL
+IoTDB> SELECT * FROM TUMBLE( DATA => bid, TIMECOL => 'time', SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY TIME
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM TUMBLE(DATA => bid, TIMECOL => 'time', SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 10.6 CUMULATE
+
+#### 10.6.1 功能描述
+
+Cumulate 函数用于从初始的窗口开始,创建相同窗口开始但窗口结束步长不同的窗口,直到达到最大的窗口大小。每个窗口包含其区间内的元素。例如:1小时步长,24小时大小的累计窗口,每天可以获得如下这些窗口:`[00:00, 01:00)`,`[00:00, 02:00)`,`[00:00, 03:00)`, …, `[00:00, 24:00)`
+
+#### 10.6.2 函数定义
+
+```sql
+CUMULATE(data, timecol, size, step[, origin])
+```
+
+#### 10.6.3 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| --------- | ---------- | --------------------------------- | -------------------------------------------- |
+| DATA | 表参数 | ROW SEMANTICPASS THROUGH | 输入表 |
+| TIMECOL | 标量参数 | 字符串类型默认值:time | 时间列 |
+| SIZE | 标量参数 | 长整数类型 | 窗口大小,SIZE必须是STEP的整数倍,需为正数 |
+| STEP | 标量参数 | 长整数类型 | 窗口步长,需为正数 |
+| ORIGIN | 标量参数 | 时间戳类型默认值:Unix 纪元时间 | 第一个窗口起始时间 |
+
+> 注意:size 如果不是 step 的整数倍,则会报错`Cumulative table function requires size must be an integral multiple of step`
+
+#### 10.6.4 返回结果
+
+CUMULATE函数的返回结果列包含:
+
+* window\_start: 窗口开始时间(闭区间)
+* window\_end: 窗口结束时间(开区间)
+* 映射列:DATA 参数的所有输入列
+
+#### 10.6.5 使用示例
+
+```sql
+IoTDB> SELECT * FROM CUMULATE(DATA => bid,TIMECOL => 'time',STEP => 2m,SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:16:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:18:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:06:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY TIME
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM CUMULATE(DATA => bid,TIMECOL => 'time',STEP => 2m, SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:16:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:18:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:06:00.000+08:00| AAPL| 100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00| AAPL| 101.5|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
diff --git a/src/zh/UserGuide/Master/Table/SQL-Manual/Featured-Functions.md b/src/zh/UserGuide/Master/Table/SQL-Manual/Featured-Functions.md
index d35c99c1d..cfdb5567a 100644
--- a/src/zh/UserGuide/Master/Table/SQL-Manual/Featured-Functions.md
+++ b/src/zh/UserGuide/Master/Table/SQL-Manual/Featured-Functions.md
@@ -324,3 +324,376 @@ WHERE device_id = '100';
|2024-11-26T13:38:00.000+08:00| 90.0| 0.0| 0.0|
+-----------------------------+-----------+-----------+-----------+
```
+
+### 1.3 表值函数
+
+原始示例数据如下:
+
+```SQL
+IoTDB> SELECT * FROM bid;
++-----------------------------+--------+-----+
+| time|stock_id|price|
++-----------------------------+--------+-----+
+|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:15:00.000+08:00| TESL|195.0|
++-----------------------------+--------+-----+
+
+-- 创建语句
+CREATE TABLE bid(time TIMESTAMP TIME, stock_id STRING TAG, price FLOAT FIELD);
+-- 插入数据
+INSERT INTO bid(time, stock_id, price) VALUES('2021-01-01T09:05:00','AAPL',100.0),('2021-01-01T09:06:00','TESL',200.0),('2021-01-01T09:07:00','AAPL',103.0),('2021-01-01T09:07:00','TESL',202.0),('2021-01-01T09:09:00','AAPL',102.0),('2021-01-01T09:15:00','TESL',195.0);
+```
+
+#### 1.3.1 HOP
+
+##### 功能描述
+
+HOP 函数用于按时间分段分窗分析,识别每一行数据所属的时间窗口。该函数通过指定固定窗口大小(size)和窗口滑动步长(SLIDE),将数据按时间戳分配到所有与其时间戳重叠的窗口中。若窗口之间存在重叠(步长 < 窗口大小),数据会自动复制到多个窗口。
+
+##### 函数定义
+
+```SQL
+HOP(data, timecol, size, slide[, origin])
+```
+
+##### 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| --------- | ---------- | --------------------------------- | -------------------- |
+| DATA | 表参数 | ROW SEMANTICPASS THROUGH | 输入表 |
+| TIMECOL | 标量参数 | 字符串类型默认值:time | 时间列 |
+| SIZE | 标量参数 | 长整数类型 | 窗口大小 |
+| SLIDE | 标量参数 | 长整数类型 | 窗口滑动步长 |
+| ORIGIN | 标量参数 | 时间戳类型默认值:Unix 纪元时间 | 第一个窗口起始时间 |
+
+##### 返回结果
+
+HOP 函数的返回结果列包含:
+
+* window\_start: 窗口开始时间(闭区间)
+* window\_end: 窗口结束时间(开区间)
+* 映射列:DATA 参数的所有输入列
+
+##### 使用示例
+
+```SQL
+IoTDB> SELECT * FROM HOP(DATA => bid,TIMECOL => 'time',SLIDE => 5m,SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:25:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY TIME
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM HOP(DATA => bid,TIMECOL => 'time',SLIDE => 5m,SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:25:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+#### 1.3.2 SESSION
+
+##### 功能描述
+
+SESSION 函数用于按会话间隔对数据进行分窗。系统逐行检查与前一行的时间间隔,小于阈值(GAP)则归入当前窗口,超过则归入下一个窗口。
+
+##### 函数定义
+
+```SQL
+SESSION(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], timecol, gap)
+```
+##### 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| --------- | ---------- | -------------------------- | ---------------------------------------- |
+| DATA | 表参数 | SET SEMANTICPASS THROUGH | 输入表通过 pkeys、okeys 指定分区和排序 |
+| TIMECOL | 标量参数 | 字符串类型默认值:'time' | 时间列名
+|
+| GAP | 标量参数 | 长整数类型 | 会话间隔阈值 |
+
+##### 返回结果
+
+SESSION 函数的返回结果列包含:
+
+* window\_start: 会话窗口内的第一条数据的时间
+* window\_end: 会话窗口内的最后一条数据的时间
+* 映射列:DATA 参数的所有输入列
+
+##### 使用示例
+
+```SQL
+IoTDB> SELECT * FROM SESSION(DATA => bid PARTITION BY stock_id ORDER BY time,TIMECOL => 'time',GAP => 2m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY SESSION
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM SESSION(DATA => bid PARTITION BY stock_id ORDER BY time,TIMECOL => 'time',GAP => 2m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+#### 1.3.3 VARIATION
+
+##### 功能描述
+
+VARIATION 函数用于按数据差值分窗,将第一条数据作为首个窗口的基准值,每个数据点会与基准值进行差值运算,如果差值小于给定的阈值(delta)则加入当前窗口;如果超过阈值,则分为下一个窗口,将该值作为下一个窗口的基准值。
+
+##### 函数定义
+
+```sql
+VARIATION(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], col, delta)
+```
+
+##### 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| -------- | ---------- | -------------------------- | ---------------------------------------- |
+| DATA | 表参数 | SET SEMANTICPASS THROUGH | 输入表通过 pkeys、okeys 指定分区和排序 |
+| COL | 标量参数 | 字符串类型 | 标识对哪一列计算差值 |
+| DELTA | 标量参数 | 浮点数类型 | 差值阈值 |
+
+##### 返回结果
+
+VARIATION 函数的返回结果列包含:
+
+* window\_index: 窗口编号
+* 映射列:DATA 参数的所有输入列
+
+##### 使用示例
+
+```sql
+IoTDB> SELECT * FROM VARIATION(DATA => bid PARTITION BY stock_id ORDER BY time,COL => 'price',DELTA => 2.0);
++------------+-----------------------------+--------+-----+
+|window_index| time|stock_id|price|
++------------+-----------------------------+--------+-----+
+| 0|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+| 0|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+| 1|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+| 0|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+| 1|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+| 1|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY VARIATION
+IoTDB> SELECT first(time) as window_start, last(time) as window_end, stock_id, avg(price) as avg FROM VARIATION(DATA => bid PARTITION BY stock_id ORDER BY time,COL => 'price', DELTA => 2.0) GROUP BY window_index, stock_id;
++-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:07:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.5|
++-----------------------------+-----------------------------+--------+-----+
+```
+
+#### 1.3.4 CAPACITY
+
+##### 功能描述
+
+CAPACITY 函数用于按数据点数(行数)分窗,每个窗口最多有 SIZE 行数据。
+
+##### 函数定义
+
+```sql
+CAPACITY(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], size)
+```
+
+##### 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| -------- | ---------- | -------------------------- | ---------------------------------------- |
+| DATA | 表参数 | SET SEMANTICPASS THROUGH | 输入表通过 pkeys、okeys 指定分区和排序 |
+| SIZE | 标量参数 | 长整数类型 | 窗口大小 |
+
+##### 返回结果
+
+CAPACITY 函数的返回结果列包含:
+
+* window\_index: 窗口编号
+* 映射列:DATA 参数的所有输入列
+
+##### 使用示例
+
+```sql
+IoTDB> SELECT * FROM CAPACITY(DATA => bid PARTITION BY stock_id ORDER BY time, SIZE => 2);
++------------+-----------------------------+--------+-----+
+|window_index| time|stock_id|price|
++------------+-----------------------------+--------+-----+
+| 0|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+| 0|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+| 1|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+| 0|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+| 0|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+| 1|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY COUNT
+IoTDB> SELECT first(time) as start_time, last(time) as end_time, stock_id, avg(price) as avg FROM CAPACITY(DATA => bid PARTITION BY stock_id ORDER BY time, SIZE => 2) GROUP BY window_index, stock_id;
++-----------------------------+-----------------------------+--------+-----+
+| start_time| end_time|stock_id| avg|
++-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|101.5|
+|2021-01-01T09:09:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+--------+-----+
+```
+
+#### 1.3.5 TUMBLE
+
+##### 功能描述
+
+TUMBLE 函数用于通过时间属性字段为每行数据分配一个窗口,滚动窗口的大小固定且不重复。
+
+##### 函数定义
+
+```sql
+TUMBLE(data, timecol, size[, origin])
+```
+##### 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| --------- | ---------- | --------------------------------- | -------------------- |
+| DATA | 表参数 | ROW SEMANTICPASS THROUGH | 输入表 |
+| TIMECOL | 标量参数 | 字符串类型默认值:time | 时间列 |
+| SIZE | 标量参数 | 长整数类型 | 窗口大小,需为正数 |
+| ORIGIN | 标量参数 | 时间戳类型默认值:Unix 纪元时间 | 第一个窗口起始时间 |
+
+##### 返回结果
+
+TUBMLE 函数的返回结果列包含:
+
+* window\_start: 窗口开始时间(闭区间)
+* window\_end: 窗口结束时间(开区间)
+* 映射列:DATA 参数的所有输入列
+
+##### 使用示例
+
+```SQL
+IoTDB> SELECT * FROM TUMBLE( DATA => bid, TIMECOL => 'time', SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY TIME
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM TUMBLE(DATA => bid, TIMECOL => 'time', SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+#### 1.3.6 CUMULATE
+
+##### 功能描述
+
+Cumulate 函数用于从初始的窗口开始,创建相同窗口开始但窗口结束步长不同的窗口,直到达到最大的窗口大小。每个窗口包含其区间内的元素。例如:1小时步长,24小时大小的累计窗口,每天可以获得如下这些窗口:`[00:00, 01:00)`,`[00:00, 02:00)`,`[00:00, 03:00)`, …, `[00:00, 24:00)`
+
+##### 函数定义
+
+```sql
+CUMULATE(data, timecol, size, step[, origin])
+```
+
+##### 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| --------- | ---------- | --------------------------------- | -------------------------------------------- |
+| DATA | 表参数 | ROW SEMANTICPASS THROUGH | 输入表 |
+| TIMECOL | 标量参数 | 字符串类型默认值:time | 时间列 |
+| SIZE | 标量参数 | 长整数类型 | 窗口大小,SIZE必须是STEP的整数倍,需为正数 |
+| STEP | 标量参数 | 长整数类型 | 窗口步长,需为正数 |
+| ORIGIN | 标量参数 | 时间戳类型默认值:Unix 纪元时间 | 第一个窗口起始时间 |
+
+> 注意:size 如果不是 step 的整数倍,则会报错`Cumulative table function requires size must be an integral multiple of step`
+
+##### 返回结果
+
+CUMULATE函数的返回结果列包含:
+
+* window\_start: 窗口开始时间(闭区间)
+* window\_end: 窗口结束时间(开区间)
+* 映射列:DATA 参数的所有输入列
+
+##### 使用示例
+
+```sql
+IoTDB> SELECT * FROM CUMULATE(DATA => bid,TIMECOL => 'time',STEP => 2m,SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:16:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:18:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:06:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY TIME
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM CUMULATE(DATA => bid,TIMECOL => 'time',STEP => 2m, SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:16:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:18:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:06:00.000+08:00| AAPL| 100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00| AAPL| 101.5|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
diff --git a/src/zh/UserGuide/Master/Table/User-Manual/User-defined-function.md b/src/zh/UserGuide/Master/Table/User-Manual/User-defined-function.md
index 22275669a..4d89c8590 100644
--- a/src/zh/UserGuide/Master/Table/User-Manual/User-defined-function.md
+++ b/src/zh/UserGuide/Master/Table/User-Manual/User-defined-function.md
@@ -25,17 +25,20 @@
UDF(User Defined Function)即用户自定义函数,IoTDB 提供多种内置的时序处理函数,也支持扩展自定义函数来满足更多的计算需求。
-IoTDB 表模型中支持两种类型的 UDF ,如下表所示。
+IoTDB 表模型中支持三种类型的 UDF ,如下表所示。
-| UDF 类型 | 函数类型 | 描述 |
-| ----------------------------------------- | ---------- | --------------------------------------------------- |
+| UDF 类型 | 函数类型 | 描述 |
+|-----------------------------------------|------|--------------------------------|
| `UDSF(User-defined Scalar Function)` | 标量函数 | 输入 k 列 1 行数据,输出1 列 1 行数据(一对一)。 |
| `UDAF(User-defined Aggregate Function)` | 聚合函数 | 输入k 列 m 行数据,输出1 列 1 行数据(多对一)。 |
+| `UDTF(User-defined Table Function)` | 表函数 | 根据输入的动态参数生成“表”形式的结果集。 |
* `UDSF` 可用于标量函数出现的任何子句和表达式中,如select子句、where子句等。
* `select udsf1(s1) from table1 where udsf2(s1)>0`
* `UDAF` 可用于聚合函数出现的任何子句和表达式中,如select子句、having子句等;
* `select udaf1(s1), device_id from table1 group by device_id having udaf2(s1)>0 `
+* `UDTF` 可以像关系表一样在from子句中使用;
+ * `select * from udtf('t1', bid);`
## 2. UDF 管理
@@ -329,6 +332,104 @@ public interface AggregateFunction extends SQLFunction {
示例:[UDAF 的实现示例](https://github.com/apache/iotdb/blob/master/example/udf/src/main/java/org/apache/iotdb/udf/AggregateFunctionExample.java),计算不为 NULL 的行数。
-### 3.4 完整Maven项目示例
+### 3.4 表函数(UDTF)
+
+#### 3.4.1 定义
+
+表函数,也被称为表值函数(Table-Valued Function,TVF),不同于标量函数、聚合函数和窗口函数的返回值是一个“标量值”,表函数的返回值是一个“表”(结果集)。
+
+#### 3.4.2 使用
+
+表函数可以像关系表一样,以`tableFunctionCall`的形式在 SQL 查询的 `FROM` 子句中使用,支持传递参数,并根据参数动态生成结果集。
+
+#### 3.4.3 语法
+
+`tableFunctionCall` 的具体定义如下所示:
+
+```sql
+tableFunctionCall
+ : qualifiedName '(' (tableFunctionArgument (',' tableFunctionArgument)*)?')'
+ ;
+
+tableFunctionArgument
+ : (identifier '=>')? (tableArgument | scalarArgument)
+ ;
+
+tableArgument
+ : tableArgumentRelation
+ (PARTITION BY ('(' (expression (',' expression)*)? ')' | expression))?
+ (ORDER BY ('(' sortItem (',' sortItem)* ')' | sortItem))?
+ ;
+
+tableArgumentRelation
+ : qualifiedName (AS? identifier columnAliases?)? #tableArgumentTable
+ | '(' query ')' (AS? identifier columnAliases?)? #tableArgumentQuery
+ ;
+
+scalarArgument
+ : expression
+ | timeDuration
+ ;
+```
+
+例如:
+
+```SQL
+// 这是从表函数中进行查询,传入一个字符串“t1”参数。
+select * from tvf('t1');
+
+// 这是从表函数中进行查询,传入一个字符串“t1”参数,一个 bid 表参数。
+select * from tvf('t1', bid);
+```
+
+#### 3.4.4 函数参数
+
+IoTDB 中的表函数为多态表值函数,支持参数类型如下所示:
+
+| 参数类型 | 定义 | 示例 |
+| ------------------------------ | ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
+| 标量参数(Scalar Argument)| 必须是常量表达式,可以是任何的 SQL 数据类型,需要和声明的类型兼容。| `SIZE => 42`,`SIZE => '42'`,`SIZE => 42.2`,`SIZE => 12h`,`SIZE => 60m` |
+| 表参数(Table Argument) | 可以是一个表名或一条查询语句。 | `input => orders`,`data => (SELECT * FROM region, nation WHERE region.regionkey = nation.regionkey)` |
+
+表参数具有如下属性:
+
+1. 组语义与行语义
+ * 被声明为组语义(Set Semantic)的表参数意味着需要根据整个完整的分区才能得到结果集。
+ * 允许在调用时指定 PARTITION 或 ORDER,执行引擎会 partition-by-partition 地进行处理。
+
+ ```SQL
+ input => orders PARTITION BY device_id ORDER BY time
+ ```
+
+ * 如果没有指定 PARTITION,则认为所有的数据都在同一个数据组中。
+ * 被声明为行语义(Row Semantics)的表参数意味着行与行之间没有依赖关系。不允许在调用时指定 PARTITION 或 ORDER,执行引擎会 row-by-row 地进行处理。
+
+2. 列穿透(Pass-through Columns)
+ * 表参数如果被声明为列穿透,则表函数的结果列会包含该表参数输入的所有列。
+ * 例如,窗口分析函数,通过为表参数设置列穿透属性,可实现输出结果为“所有输入列(包含原始列和聚合结果)+窗口ID”,即“原始数据+分析结果”。
+
+#### 3.4.5 传递方式
+
+| 传递方式 | 描述 | 示例 |
+| ------------ |-----------------------------------------------------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| 按名传递 | 1. 可以通过任意的顺序传递参数。
2. 被声明有默认值的参数可以被省略。
3. 参数名大小写不敏感。 | `SELECT * FROM my_function(row_count => 100, column_count => 1);` `SELECT * FROM my_function(column_count => 1, row_count => 100);` `SELECT * FROM my_function(column_count => 1);` |
+| 按位置传递 | 1. 必须按照声明的顺序进行传递参数。
2. 如果余下的参数都有默认值,可以只传一部分参数。 | `SELECT * FROM my_function(1, 100);` `SELECT * FROM my_function(1);` |
+
+> 注意:
+> 以上两种方式不允许混用,否则在语义解析时候会抛出“**All arguments must be passed by name or all must be passed positionally**”异常。
+
+#### 3.4.6 返回结果
+
+表函数的结果集由以下两部分组成。
+
+1. 由表函数创建的生成列(Proper Columns)。
+2. 根据表参数自动构建的映射列(Pass-through Columns)。
+ * 如果指定了表参数的属性为列穿透,则会包括输入关系的所有列;
+ * 如果没有指定为列穿透但指定了 PartitionBy,则是 PartitionBy 的列;
+ * 如果均未指定,则不根据表参数自动构建列。
+
+
+
+### 3.5 完整Maven项目示例
如果使用 [Maven](http://search.maven.org/),可以参考示例项目[udf-example](https://github.com/apache/iotdb/tree/master/example/udf)。
diff --git a/src/zh/UserGuide/latest-Table/SQL-Manual/Basis-Function.md b/src/zh/UserGuide/latest-Table/SQL-Manual/Basis-Function.md
index 00e421f38..33ca019b8 100644
--- a/src/zh/UserGuide/latest-Table/SQL-Manual/Basis-Function.md
+++ b/src/zh/UserGuide/latest-Table/SQL-Manual/Basis-Function.md
@@ -1151,4 +1151,377 @@ SELECT regexp_like('1a 2b 14m', '^\\d+b$'); -- false
- **说明**:检查字符串 `'1a 2b 14m'` 是否完全匹配模式 `^\\d+b$`。
- `\d+` 表示“一个或多个数字”。
- `b` 表示字母 `b`。
- - `'1a 2b 14m'` 并不符合这个模式,因为它不是从数字开始,也不是以 `b` 结束,所以返回 `false`。
\ No newline at end of file
+ - `'1a 2b 14m'` 并不符合这个模式,因为它不是从数字开始,也不是以 `b` 结束,所以返回 `false`。
+
+## 10. 表值函数
+
+原始示例数据如下:
+
+```SQL
+IoTDB> SELECT * FROM bid;
++-----------------------------+--------+-----+
+| time|stock_id|price|
++-----------------------------+--------+-----+
+|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:15:00.000+08:00| TESL|195.0|
++-----------------------------+--------+-----+
+
+-- 创建语句
+CREATE TABLE bid(time TIMESTAMP TIME, stock_id STRING TAG, price FLOAT FIELD);
+-- 插入数据
+INSERT INTO bid(time, stock_id, price) VALUES('2021-01-01T09:05:00','AAPL',100.0),('2021-01-01T09:06:00','TESL',200.0),('2021-01-01T09:07:00','AAPL',103.0),('2021-01-01T09:07:00','TESL',202.0),('2021-01-01T09:09:00','AAPL',102.0),('2021-01-01T09:15:00','TESL',195.0);
+```
+
+### 10.1 HOP
+
+#### 10.1.1 功能描述
+
+HOP 函数用于按时间分段分窗分析,识别每一行数据所属的时间窗口。该函数通过指定固定窗口大小(size)和窗口滑动步长(SLIDE),将数据按时间戳分配到所有与其时间戳重叠的窗口中。若窗口之间存在重叠(步长 < 窗口大小),数据会自动复制到多个窗口。
+
+#### 10.1.2 函数定义
+
+```SQL
+HOP(data, timecol, size, slide[, origin])
+```
+
+#### 10.1.3 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| --------- | ---------- | --------------------------------- | -------------------- |
+| DATA | 表参数 | ROW SEMANTICPASS THROUGH | 输入表 |
+| TIMECOL | 标量参数 | 字符串类型默认值:time | 时间列 |
+| SIZE | 标量参数 | 长整数类型 | 窗口大小 |
+| SLIDE | 标量参数 | 长整数类型 | 窗口滑动步长 |
+| ORIGIN | 标量参数 | 时间戳类型默认值:Unix 纪元时间 | 第一个窗口起始时间 |
+
+#### 10.1.4 返回结果
+
+HOP 函数的返回结果列包含:
+
+* window\_start: 窗口开始时间(闭区间)
+* window\_end: 窗口结束时间(开区间)
+* 映射列:DATA 参数的所有输入列
+
+#### 10.1.5 使用示例
+
+```SQL
+IoTDB> SELECT * FROM HOP(DATA => bid,TIMECOL => 'time',SLIDE => 5m,SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:25:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY TIME
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM HOP(DATA => bid,TIMECOL => 'time',SLIDE => 5m,SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:25:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 10.2 SESSION
+
+#### 10.2.1 功能描述
+
+SESSION 函数用于按会话间隔对数据进行分窗。系统逐行检查与前一行的时间间隔,小于阈值(GAP)则归入当前窗口,超过则归入下一个窗口。
+
+#### 10.2.2 函数定义
+
+```SQL
+SESSION(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], timecol, gap)
+```
+#### 10.2.3 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| --------- | ---------- | -------------------------- | ---------------------------------------- |
+| DATA | 表参数 | SET SEMANTICPASS THROUGH | 输入表通过 pkeys、okeys 指定分区和排序 |
+| TIMECOL | 标量参数 | 字符串类型默认值:'time' | 时间列名
+|
+| GAP | 标量参数 | 长整数类型 | 会话间隔阈值 |
+
+#### 10.2.4 返回结果
+
+SESSION 函数的返回结果列包含:
+
+* window\_start: 会话窗口内的第一条数据的时间
+* window\_end: 会话窗口内的最后一条数据的时间
+* 映射列:DATA 参数的所有输入列
+
+#### 10.2.5 使用示例
+
+```SQL
+IoTDB> SELECT * FROM SESSION(DATA => bid PARTITION BY stock_id ORDER BY time,TIMECOL => 'time',GAP => 2m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY SESSION
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM SESSION(DATA => bid PARTITION BY stock_id ORDER BY time,TIMECOL => 'time',GAP => 2m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 10.3 VARIATION
+
+#### 10.3.1 功能描述
+
+VARIATION 函数用于按数据差值分窗,将第一条数据作为首个窗口的基准值,每个数据点会与基准值进行差值运算,如果差值小于给定的阈值(delta)则加入当前窗口;如果超过阈值,则分为下一个窗口,将该值作为下一个窗口的基准值。
+
+#### 10.3.2 函数定义
+
+```sql
+VARIATION(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], col, delta)
+```
+
+#### 10.3.3 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| -------- | ---------- | -------------------------- | ---------------------------------------- |
+| DATA | 表参数 | SET SEMANTICPASS THROUGH | 输入表通过 pkeys、okeys 指定分区和排序 |
+| COL | 标量参数 | 字符串类型 | 标识对哪一列计算差值 |
+| DELTA | 标量参数 | 浮点数类型 | 差值阈值 |
+
+#### 10.3.4 返回结果
+
+VARIATION 函数的返回结果列包含:
+
+* window\_index: 窗口编号
+* 映射列:DATA 参数的所有输入列
+
+#### 10.3.5 使用示例
+
+```sql
+IoTDB> SELECT * FROM VARIATION(DATA => bid PARTITION BY stock_id ORDER BY time,COL => 'price',DELTA => 2.0);
++------------+-----------------------------+--------+-----+
+|window_index| time|stock_id|price|
++------------+-----------------------------+--------+-----+
+| 0|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+| 0|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+| 1|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+| 0|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+| 1|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+| 1|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY VARIATION
+IoTDB> SELECT first(time) as window_start, last(time) as window_end, stock_id, avg(price) as avg FROM VARIATION(DATA => bid PARTITION BY stock_id ORDER BY time,COL => 'price', DELTA => 2.0) GROUP BY window_index, stock_id;
++-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:07:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.5|
++-----------------------------+-----------------------------+--------+-----+
+```
+
+### 10.4 CAPACITY
+
+#### 10.4.1 功能描述
+
+CAPACITY 函数用于按数据点数(行数)分窗,每个窗口最多有 SIZE 行数据。
+
+#### 10.4.2 函数定义
+
+```sql
+CAPACITY(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], size)
+```
+
+#### 10.4.3 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| -------- | ---------- | -------------------------- | ---------------------------------------- |
+| DATA | 表参数 | SET SEMANTICPASS THROUGH | 输入表通过 pkeys、okeys 指定分区和排序 |
+| SIZE | 标量参数 | 长整数类型 | 窗口大小 |
+
+#### 10.4.4 返回结果
+
+CAPACITY 函数的返回结果列包含:
+
+* window\_index: 窗口编号
+* 映射列:DATA 参数的所有输入列
+
+#### 10.4.5 使用示例
+
+```sql
+IoTDB> SELECT * FROM CAPACITY(DATA => bid PARTITION BY stock_id ORDER BY time, SIZE => 2);
++------------+-----------------------------+--------+-----+
+|window_index| time|stock_id|price|
++------------+-----------------------------+--------+-----+
+| 0|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+| 0|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+| 1|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+| 0|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+| 0|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+| 1|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY COUNT
+IoTDB> SELECT first(time) as start_time, last(time) as end_time, stock_id, avg(price) as avg FROM CAPACITY(DATA => bid PARTITION BY stock_id ORDER BY time, SIZE => 2) GROUP BY window_index, stock_id;
++-----------------------------+-----------------------------+--------+-----+
+| start_time| end_time|stock_id| avg|
++-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|101.5|
+|2021-01-01T09:09:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+--------+-----+
+```
+
+### 10.5 TUMBLE
+
+#### 10.5.1 功能描述
+
+TUMBLE 函数用于通过时间属性字段为每行数据分配一个窗口,滚动窗口的大小固定且不重复。
+
+#### 10.5.2 函数定义
+
+```sql
+TUMBLE(data, timecol, size[, origin])
+```
+#### 10.5.3 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| --------- | ---------- | --------------------------------- | -------------------- |
+| DATA | 表参数 | ROW SEMANTICPASS THROUGH | 输入表 |
+| TIMECOL | 标量参数 | 字符串类型默认值:time | 时间列 |
+| SIZE | 标量参数 | 长整数类型 | 窗口大小,需为正数 |
+| ORIGIN | 标量参数 | 时间戳类型默认值:Unix 纪元时间 | 第一个窗口起始时间 |
+
+#### 10.5.4 返回结果
+
+TUBMLE 函数的返回结果列包含:
+
+* window\_start: 窗口开始时间(闭区间)
+* window\_end: 窗口结束时间(开区间)
+* 映射列:DATA 参数的所有输入列
+
+#### 10.5.5 使用示例
+
+```SQL
+IoTDB> SELECT * FROM TUMBLE( DATA => bid, TIMECOL => 'time', SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY TIME
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM TUMBLE(DATA => bid, TIMECOL => 'time', SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+### 10.6 CUMULATE
+
+#### 10.6.1 功能描述
+
+Cumulate 函数用于从初始的窗口开始,创建相同窗口开始但窗口结束步长不同的窗口,直到达到最大的窗口大小。每个窗口包含其区间内的元素。例如:1小时步长,24小时大小的累计窗口,每天可以获得如下这些窗口:`[00:00, 01:00)`,`[00:00, 02:00)`,`[00:00, 03:00)`, …, `[00:00, 24:00)`
+
+#### 10.6.2 函数定义
+
+```sql
+CUMULATE(data, timecol, size, step[, origin])
+```
+
+#### 10.6.3 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| --------- | ---------- | --------------------------------- | -------------------------------------------- |
+| DATA | 表参数 | ROW SEMANTICPASS THROUGH | 输入表 |
+| TIMECOL | 标量参数 | 字符串类型默认值:time | 时间列 |
+| SIZE | 标量参数 | 长整数类型 | 窗口大小,SIZE必须是STEP的整数倍,需为正数 |
+| STEP | 标量参数 | 长整数类型 | 窗口步长,需为正数 |
+| ORIGIN | 标量参数 | 时间戳类型默认值:Unix 纪元时间 | 第一个窗口起始时间 |
+
+> 注意:size 如果不是 step 的整数倍,则会报错`Cumulative table function requires size must be an integral multiple of step`
+
+#### 10.6.4 返回结果
+
+CUMULATE函数的返回结果列包含:
+
+* window\_start: 窗口开始时间(闭区间)
+* window\_end: 窗口结束时间(开区间)
+* 映射列:DATA 参数的所有输入列
+
+#### 10.6.5 使用示例
+
+```sql
+IoTDB> SELECT * FROM CUMULATE(DATA => bid,TIMECOL => 'time',STEP => 2m,SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:16:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:18:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:06:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY TIME
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM CUMULATE(DATA => bid,TIMECOL => 'time',STEP => 2m, SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:16:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:18:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:06:00.000+08:00| AAPL| 100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00| AAPL| 101.5|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
diff --git a/src/zh/UserGuide/latest-Table/SQL-Manual/Featured-Functions.md b/src/zh/UserGuide/latest-Table/SQL-Manual/Featured-Functions.md
index d35c99c1d..cfdb5567a 100644
--- a/src/zh/UserGuide/latest-Table/SQL-Manual/Featured-Functions.md
+++ b/src/zh/UserGuide/latest-Table/SQL-Manual/Featured-Functions.md
@@ -324,3 +324,376 @@ WHERE device_id = '100';
|2024-11-26T13:38:00.000+08:00| 90.0| 0.0| 0.0|
+-----------------------------+-----------+-----------+-----------+
```
+
+### 1.3 表值函数
+
+原始示例数据如下:
+
+```SQL
+IoTDB> SELECT * FROM bid;
++-----------------------------+--------+-----+
+| time|stock_id|price|
++-----------------------------+--------+-----+
+|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:15:00.000+08:00| TESL|195.0|
++-----------------------------+--------+-----+
+
+-- 创建语句
+CREATE TABLE bid(time TIMESTAMP TIME, stock_id STRING TAG, price FLOAT FIELD);
+-- 插入数据
+INSERT INTO bid(time, stock_id, price) VALUES('2021-01-01T09:05:00','AAPL',100.0),('2021-01-01T09:06:00','TESL',200.0),('2021-01-01T09:07:00','AAPL',103.0),('2021-01-01T09:07:00','TESL',202.0),('2021-01-01T09:09:00','AAPL',102.0),('2021-01-01T09:15:00','TESL',195.0);
+```
+
+#### 1.3.1 HOP
+
+##### 功能描述
+
+HOP 函数用于按时间分段分窗分析,识别每一行数据所属的时间窗口。该函数通过指定固定窗口大小(size)和窗口滑动步长(SLIDE),将数据按时间戳分配到所有与其时间戳重叠的窗口中。若窗口之间存在重叠(步长 < 窗口大小),数据会自动复制到多个窗口。
+
+##### 函数定义
+
+```SQL
+HOP(data, timecol, size, slide[, origin])
+```
+
+##### 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| --------- | ---------- | --------------------------------- | -------------------- |
+| DATA | 表参数 | ROW SEMANTICPASS THROUGH | 输入表 |
+| TIMECOL | 标量参数 | 字符串类型默认值:time | 时间列 |
+| SIZE | 标量参数 | 长整数类型 | 窗口大小 |
+| SLIDE | 标量参数 | 长整数类型 | 窗口滑动步长 |
+| ORIGIN | 标量参数 | 时间戳类型默认值:Unix 纪元时间 | 第一个窗口起始时间 |
+
+##### 返回结果
+
+HOP 函数的返回结果列包含:
+
+* window\_start: 窗口开始时间(闭区间)
+* window\_end: 窗口结束时间(开区间)
+* 映射列:DATA 参数的所有输入列
+
+##### 使用示例
+
+```SQL
+IoTDB> SELECT * FROM HOP(DATA => bid,TIMECOL => 'time',SLIDE => 5m,SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:25:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY TIME
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM HOP(DATA => bid,TIMECOL => 'time',SLIDE => 5m,SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:25:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:15:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+#### 1.3.2 SESSION
+
+##### 功能描述
+
+SESSION 函数用于按会话间隔对数据进行分窗。系统逐行检查与前一行的时间间隔,小于阈值(GAP)则归入当前窗口,超过则归入下一个窗口。
+
+##### 函数定义
+
+```SQL
+SESSION(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], timecol, gap)
+```
+##### 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| --------- | ---------- | -------------------------- | ---------------------------------------- |
+| DATA | 表参数 | SET SEMANTICPASS THROUGH | 输入表通过 pkeys、okeys 指定分区和排序 |
+| TIMECOL | 标量参数 | 字符串类型默认值:'time' | 时间列名
+|
+| GAP | 标量参数 | 长整数类型 | 会话间隔阈值 |
+
+##### 返回结果
+
+SESSION 函数的返回结果列包含:
+
+* window\_start: 会话窗口内的第一条数据的时间
+* window\_end: 会话窗口内的最后一条数据的时间
+* 映射列:DATA 参数的所有输入列
+
+##### 使用示例
+
+```SQL
+IoTDB> SELECT * FROM SESSION(DATA => bid PARTITION BY stock_id ORDER BY time,TIMECOL => 'time',GAP => 2m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY SESSION
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM SESSION(DATA => bid PARTITION BY stock_id ORDER BY time,TIMECOL => 'time',GAP => 2m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+#### 1.3.3 VARIATION
+
+##### 功能描述
+
+VARIATION 函数用于按数据差值分窗,将第一条数据作为首个窗口的基准值,每个数据点会与基准值进行差值运算,如果差值小于给定的阈值(delta)则加入当前窗口;如果超过阈值,则分为下一个窗口,将该值作为下一个窗口的基准值。
+
+##### 函数定义
+
+```sql
+VARIATION(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], col, delta)
+```
+
+##### 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| -------- | ---------- | -------------------------- | ---------------------------------------- |
+| DATA | 表参数 | SET SEMANTICPASS THROUGH | 输入表通过 pkeys、okeys 指定分区和排序 |
+| COL | 标量参数 | 字符串类型 | 标识对哪一列计算差值 |
+| DELTA | 标量参数 | 浮点数类型 | 差值阈值 |
+
+##### 返回结果
+
+VARIATION 函数的返回结果列包含:
+
+* window\_index: 窗口编号
+* 映射列:DATA 参数的所有输入列
+
+##### 使用示例
+
+```sql
+IoTDB> SELECT * FROM VARIATION(DATA => bid PARTITION BY stock_id ORDER BY time,COL => 'price',DELTA => 2.0);
++------------+-----------------------------+--------+-----+
+|window_index| time|stock_id|price|
++------------+-----------------------------+--------+-----+
+| 0|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+| 0|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+| 1|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+| 0|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+| 1|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+| 1|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY VARIATION
+IoTDB> SELECT first(time) as window_start, last(time) as window_end, stock_id, avg(price) as avg FROM VARIATION(DATA => bid PARTITION BY stock_id ORDER BY time,COL => 'price', DELTA => 2.0) GROUP BY window_index, stock_id;
++-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:07:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.5|
++-----------------------------+-----------------------------+--------+-----+
+```
+
+#### 1.3.4 CAPACITY
+
+##### 功能描述
+
+CAPACITY 函数用于按数据点数(行数)分窗,每个窗口最多有 SIZE 行数据。
+
+##### 函数定义
+
+```sql
+CAPACITY(data [PARTITION BY(pkeys, ...)] [ORDER BY(okeys, ...)], size)
+```
+
+##### 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| -------- | ---------- | -------------------------- | ---------------------------------------- |
+| DATA | 表参数 | SET SEMANTICPASS THROUGH | 输入表通过 pkeys、okeys 指定分区和排序 |
+| SIZE | 标量参数 | 长整数类型 | 窗口大小 |
+
+##### 返回结果
+
+CAPACITY 函数的返回结果列包含:
+
+* window\_index: 窗口编号
+* 映射列:DATA 参数的所有输入列
+
+##### 使用示例
+
+```sql
+IoTDB> SELECT * FROM CAPACITY(DATA => bid PARTITION BY stock_id ORDER BY time, SIZE => 2);
++------------+-----------------------------+--------+-----+
+|window_index| time|stock_id|price|
++------------+-----------------------------+--------+-----+
+| 0|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+| 0|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+| 1|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+| 0|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+| 0|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+| 1|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY COUNT
+IoTDB> SELECT first(time) as start_time, last(time) as end_time, stock_id, avg(price) as avg FROM CAPACITY(DATA => bid PARTITION BY stock_id ORDER BY time, SIZE => 2) GROUP BY window_index, stock_id;
++-----------------------------+-----------------------------+--------+-----+
+| start_time| end_time|stock_id| avg|
++-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:06:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|201.0|
+|2021-01-01T09:15:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:05:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|101.5|
+|2021-01-01T09:09:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+--------+-----+
+```
+
+#### 1.3.5 TUMBLE
+
+##### 功能描述
+
+TUMBLE 函数用于通过时间属性字段为每行数据分配一个窗口,滚动窗口的大小固定且不重复。
+
+##### 函数定义
+
+```sql
+TUMBLE(data, timecol, size[, origin])
+```
+##### 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| --------- | ---------- | --------------------------------- | -------------------- |
+| DATA | 表参数 | ROW SEMANTICPASS THROUGH | 输入表 |
+| TIMECOL | 标量参数 | 字符串类型默认值:time | 时间列 |
+| SIZE | 标量参数 | 长整数类型 | 窗口大小,需为正数 |
+| ORIGIN | 标量参数 | 时间戳类型默认值:Unix 纪元时间 | 第一个窗口起始时间 |
+
+##### 返回结果
+
+TUBMLE 函数的返回结果列包含:
+
+* window\_start: 窗口开始时间(闭区间)
+* window\_end: 窗口结束时间(开区间)
+* 映射列:DATA 参数的所有输入列
+
+##### 使用示例
+
+```SQL
+IoTDB> SELECT * FROM TUMBLE( DATA => bid, TIMECOL => 'time', SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY TIME
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM TUMBLE(DATA => bid, TIMECOL => 'time', SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
+
+#### 1.3.6 CUMULATE
+
+##### 功能描述
+
+Cumulate 函数用于从初始的窗口开始,创建相同窗口开始但窗口结束步长不同的窗口,直到达到最大的窗口大小。每个窗口包含其区间内的元素。例如:1小时步长,24小时大小的累计窗口,每天可以获得如下这些窗口:`[00:00, 01:00)`,`[00:00, 02:00)`,`[00:00, 03:00)`, …, `[00:00, 24:00)`
+
+##### 函数定义
+
+```sql
+CUMULATE(data, timecol, size, step[, origin])
+```
+
+##### 参数说明
+
+| 参数名 | 参数类型 | 参数属性 | 描述 |
+| --------- | ---------- | --------------------------------- | -------------------------------------------- |
+| DATA | 表参数 | ROW SEMANTICPASS THROUGH | 输入表 |
+| TIMECOL | 标量参数 | 字符串类型默认值:time | 时间列 |
+| SIZE | 标量参数 | 长整数类型 | 窗口大小,SIZE必须是STEP的整数倍,需为正数 |
+| STEP | 标量参数 | 长整数类型 | 窗口步长,需为正数 |
+| ORIGIN | 标量参数 | 时间戳类型默认值:Unix 纪元时间 | 第一个窗口起始时间 |
+
+> 注意:size 如果不是 step 的整数倍,则会报错`Cumulative table function requires size must be an integral multiple of step`
+
+##### 返回结果
+
+CUMULATE函数的返回结果列包含:
+
+* window\_start: 窗口开始时间(闭区间)
+* window\_end: 窗口结束时间(开区间)
+* 映射列:DATA 参数的所有输入列
+
+##### 使用示例
+
+```sql
+IoTDB> SELECT * FROM CUMULATE(DATA => bid,TIMECOL => 'time',STEP => 2m,SIZE => 10m);
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+| window_start| window_end| time|stock_id|price|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:06:00.000+08:00| TESL|200.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| TESL|202.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:16:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:18:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00|2021-01-01T09:15:00.000+08:00| TESL|195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:06:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:05:00.000+08:00| AAPL|100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:07:00.000+08:00| AAPL|103.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00|2021-01-01T09:09:00.000+08:00| AAPL|102.0|
++-----------------------------+-----------------------------+-----------------------------+--------+-----+
+
+-- 结合 GROUP BY 语句,等效于树模型的 GROUP BY TIME
+IoTDB> SELECT window_start, window_end, stock_id, avg(price) as avg FROM CUMULATE(DATA => bid,TIMECOL => 'time',STEP => 2m, SIZE => 10m) GROUP BY window_start, window_end, stock_id;
++-----------------------------+-----------------------------+--------+------------------+
+| window_start| window_end|stock_id| avg|
++-----------------------------+-----------------------------+--------+------------------+
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| TESL| 201.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:16:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:18:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:10:00.000+08:00|2021-01-01T09:20:00.000+08:00| TESL| 195.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:06:00.000+08:00| AAPL| 100.0|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:08:00.000+08:00| AAPL| 101.5|
+|2021-01-01T09:00:00.000+08:00|2021-01-01T09:10:00.000+08:00| AAPL|101.66666666666667|
++-----------------------------+-----------------------------+--------+------------------+
+```
diff --git a/src/zh/UserGuide/latest-Table/User-Manual/User-defined-function.md b/src/zh/UserGuide/latest-Table/User-Manual/User-defined-function.md
index 22275669a..4d89c8590 100644
--- a/src/zh/UserGuide/latest-Table/User-Manual/User-defined-function.md
+++ b/src/zh/UserGuide/latest-Table/User-Manual/User-defined-function.md
@@ -25,17 +25,20 @@
UDF(User Defined Function)即用户自定义函数,IoTDB 提供多种内置的时序处理函数,也支持扩展自定义函数来满足更多的计算需求。
-IoTDB 表模型中支持两种类型的 UDF ,如下表所示。
+IoTDB 表模型中支持三种类型的 UDF ,如下表所示。
-| UDF 类型 | 函数类型 | 描述 |
-| ----------------------------------------- | ---------- | --------------------------------------------------- |
+| UDF 类型 | 函数类型 | 描述 |
+|-----------------------------------------|------|--------------------------------|
| `UDSF(User-defined Scalar Function)` | 标量函数 | 输入 k 列 1 行数据,输出1 列 1 行数据(一对一)。 |
| `UDAF(User-defined Aggregate Function)` | 聚合函数 | 输入k 列 m 行数据,输出1 列 1 行数据(多对一)。 |
+| `UDTF(User-defined Table Function)` | 表函数 | 根据输入的动态参数生成“表”形式的结果集。 |
* `UDSF` 可用于标量函数出现的任何子句和表达式中,如select子句、where子句等。
* `select udsf1(s1) from table1 where udsf2(s1)>0`
* `UDAF` 可用于聚合函数出现的任何子句和表达式中,如select子句、having子句等;
* `select udaf1(s1), device_id from table1 group by device_id having udaf2(s1)>0 `
+* `UDTF` 可以像关系表一样在from子句中使用;
+ * `select * from udtf('t1', bid);`
## 2. UDF 管理
@@ -329,6 +332,104 @@ public interface AggregateFunction extends SQLFunction {
示例:[UDAF 的实现示例](https://github.com/apache/iotdb/blob/master/example/udf/src/main/java/org/apache/iotdb/udf/AggregateFunctionExample.java),计算不为 NULL 的行数。
-### 3.4 完整Maven项目示例
+### 3.4 表函数(UDTF)
+
+#### 3.4.1 定义
+
+表函数,也被称为表值函数(Table-Valued Function,TVF),不同于标量函数、聚合函数和窗口函数的返回值是一个“标量值”,表函数的返回值是一个“表”(结果集)。
+
+#### 3.4.2 使用
+
+表函数可以像关系表一样,以`tableFunctionCall`的形式在 SQL 查询的 `FROM` 子句中使用,支持传递参数,并根据参数动态生成结果集。
+
+#### 3.4.3 语法
+
+`tableFunctionCall` 的具体定义如下所示:
+
+```sql
+tableFunctionCall
+ : qualifiedName '(' (tableFunctionArgument (',' tableFunctionArgument)*)?')'
+ ;
+
+tableFunctionArgument
+ : (identifier '=>')? (tableArgument | scalarArgument)
+ ;
+
+tableArgument
+ : tableArgumentRelation
+ (PARTITION BY ('(' (expression (',' expression)*)? ')' | expression))?
+ (ORDER BY ('(' sortItem (',' sortItem)* ')' | sortItem))?
+ ;
+
+tableArgumentRelation
+ : qualifiedName (AS? identifier columnAliases?)? #tableArgumentTable
+ | '(' query ')' (AS? identifier columnAliases?)? #tableArgumentQuery
+ ;
+
+scalarArgument
+ : expression
+ | timeDuration
+ ;
+```
+
+例如:
+
+```SQL
+// 这是从表函数中进行查询,传入一个字符串“t1”参数。
+select * from tvf('t1');
+
+// 这是从表函数中进行查询,传入一个字符串“t1”参数,一个 bid 表参数。
+select * from tvf('t1', bid);
+```
+
+#### 3.4.4 函数参数
+
+IoTDB 中的表函数为多态表值函数,支持参数类型如下所示:
+
+| 参数类型 | 定义 | 示例 |
+| ------------------------------ | ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
+| 标量参数(Scalar Argument)| 必须是常量表达式,可以是任何的 SQL 数据类型,需要和声明的类型兼容。| `SIZE => 42`,`SIZE => '42'`,`SIZE => 42.2`,`SIZE => 12h`,`SIZE => 60m` |
+| 表参数(Table Argument) | 可以是一个表名或一条查询语句。 | `input => orders`,`data => (SELECT * FROM region, nation WHERE region.regionkey = nation.regionkey)` |
+
+表参数具有如下属性:
+
+1. 组语义与行语义
+ * 被声明为组语义(Set Semantic)的表参数意味着需要根据整个完整的分区才能得到结果集。
+ * 允许在调用时指定 PARTITION 或 ORDER,执行引擎会 partition-by-partition 地进行处理。
+
+ ```SQL
+ input => orders PARTITION BY device_id ORDER BY time
+ ```
+
+ * 如果没有指定 PARTITION,则认为所有的数据都在同一个数据组中。
+ * 被声明为行语义(Row Semantics)的表参数意味着行与行之间没有依赖关系。不允许在调用时指定 PARTITION 或 ORDER,执行引擎会 row-by-row 地进行处理。
+
+2. 列穿透(Pass-through Columns)
+ * 表参数如果被声明为列穿透,则表函数的结果列会包含该表参数输入的所有列。
+ * 例如,窗口分析函数,通过为表参数设置列穿透属性,可实现输出结果为“所有输入列(包含原始列和聚合结果)+窗口ID”,即“原始数据+分析结果”。
+
+#### 3.4.5 传递方式
+
+| 传递方式 | 描述 | 示例 |
+| ------------ |-----------------------------------------------------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| 按名传递 | 1. 可以通过任意的顺序传递参数。
2. 被声明有默认值的参数可以被省略。
3. 参数名大小写不敏感。 | `SELECT * FROM my_function(row_count => 100, column_count => 1);` `SELECT * FROM my_function(column_count => 1, row_count => 100);` `SELECT * FROM my_function(column_count => 1);` |
+| 按位置传递 | 1. 必须按照声明的顺序进行传递参数。
2. 如果余下的参数都有默认值,可以只传一部分参数。 | `SELECT * FROM my_function(1, 100);` `SELECT * FROM my_function(1);` |
+
+> 注意:
+> 以上两种方式不允许混用,否则在语义解析时候会抛出“**All arguments must be passed by name or all must be passed positionally**”异常。
+
+#### 3.4.6 返回结果
+
+表函数的结果集由以下两部分组成。
+
+1. 由表函数创建的生成列(Proper Columns)。
+2. 根据表参数自动构建的映射列(Pass-through Columns)。
+ * 如果指定了表参数的属性为列穿透,则会包括输入关系的所有列;
+ * 如果没有指定为列穿透但指定了 PartitionBy,则是 PartitionBy 的列;
+ * 如果均未指定,则不根据表参数自动构建列。
+
+
+
+### 3.5 完整Maven项目示例
如果使用 [Maven](http://search.maven.org/),可以参考示例项目[udf-example](https://github.com/apache/iotdb/tree/master/example/udf)。