Skip to content

Commit 8b0bb18

Browse files
committed
feat: [6598098782] Modify doc.
1 parent 5a76e8f commit 8b0bb18

File tree

6 files changed

+30
-28
lines changed

6 files changed

+30
-28
lines changed

docs/en/05-basic/03-query.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ window_clause: {
171171
When using the window clause, the following rules should be observed. These rules apply to the five window types SESSION, STATE_WINDOW, INTERVAL, EVENT_WINDOW, and COUNT_WINDOW. EXTERNAL_WINDOW has different rules; see the [External Window](#external-window) section for details.
172172

173173
1. The window clause is located after the data partitioning clause and cannot be used together with the GROUP BY clause.
174-
1. The window clause partitions the data by windows and performs calculations on the expressions in the SELECT list for each window. The expressions in the SELECT list can only include: constants; pseudocolumns: \_wstart pseudo-column,\_wend pseudo-column, and \_wduration pseudo-column; aggregate functions (including selection functions and time-series specific functions that can determine the number of output rows by parameters)
174+
1. The window clause partitions the data by windows and performs calculations on the expressions in the SELECT list for each window. The expressions in the SELECT list can only include: constants; pseudocolumns: \_wstart pseudo-column,\_wend pseudo-column, and \_wduration pseudo-column; aggregate functions (including selection functions, time-series specific functions whose output row count is determined by parameters, and window calculation / time-weighted statistics functions among the time-series specific functions)
175175
1. WHERE statements can specify the start and end times of the query and other filtering conditions.
176176

177177
:::

docs/en/14-reference/03-taos-sql/22-function.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2790,7 +2790,7 @@ LAG(expr, offset[, default_val])
27902790
- `default_val` must be type-compatible with `expr`.
27912791
- `LAG` is evaluated on the row order of the input result set; you can use `ORDER BY` to change the evaluation order.
27922792
- It can be used together with `_rowts`, `tbname`, tag columns, and also in subqueries and `PARTITION BY` scenarios.
2793-
- Window queries are not supported, such as `INTERVAL`, `SESSION`, and `STATE_WINDOW`.
2793+
- When used with a window clause, `LAG` is evaluated only within the current window in window-local row order and does not carry state across windows.
27942794

27952795
### LEAD
27962796

@@ -2813,7 +2813,7 @@ LEAD(expr, offset[, default_val])
28132813
- `default_val` must be type-compatible with `expr`.
28142814
- `LEAD` is evaluated on the row order of the input result set; you can use `ORDER BY` to change the evaluation order.
28152815
- It can be used together with `_rowts`, `tbname`, tag columns, and also in subqueries and `PARTITION BY` scenarios.
2816-
- Window queries are not supported, such as `INTERVAL`, `SESSION`, and `STATE_WINDOW`.
2816+
- When used with a window clause, `LEAD` is evaluated only within the current window in window-local row order and does not read rows from the next window.
28172817

28182818
### MAX
28192819

@@ -3135,6 +3135,7 @@ MAVG(expr, k)
31353135

31363136
- Does not support +, -, *, / operations, such as mavg(col1, k1) + mavg(col2, k1);
31373137
- Can only be used with regular columns, selection, and projection functions, not with aggregation functions;
3138+
- When used with a window clause, `MAVG` is calculated only from samples inside the current window and does not continue state across windows.
31383139

31393140
### STATECOUNT
31403141

@@ -3159,7 +3160,7 @@ STATECOUNT(expr, oper, val)
31593160

31603161
**Usage Notes**:
31613162

3162-
- Cannot be used with window operations, such as interval/state_window/session_window.
3163+
- When used with a window clause, `STATECOUNT` counts consecutive records only inside the current window and does not accumulate across windows.
31633164

31643165
### STATEDURATION
31653166

@@ -3185,7 +3186,7 @@ STATEDURATION(expr, oper, val, unit)
31853186

31863187
**Usage Notes**:
31873188

3188-
- Cannot be used with window operations, such as interval/state_window/session_window.
3189+
- When used with a window clause, `STATEDURATION` measures continuous duration only inside the current window and does not accumulate across windows.
31893190

31903191
### TWA
31913192

docs/en/14-reference/03-taos-sql/24-distinguished.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The following rules apply to the five window types SESSION, STATE_WINDOW, INTERV
6767
- The window clause divides the data by windows and calculates the expressions in the SELECT list for each window. The expressions in the SELECT list can only include:
6868
- Constants.
6969
- Pseudocolumns _wstart,_wend, and _wduration.
70-
- Aggregate functions (including selection functions and time-series specific functions that can determine the number of output rows by parameters).
70+
- Aggregate functions (including selection functions, time-series specific functions whose output row count is determined by parameters, and window calculation / time-weighted statistics functions among the time-series specific functions).
7171
- Expressions containing the above expressions.
7272
- And must include at least one aggregate function(this limitation no longer exists after version 3.4.0.0).
7373
- The window clause cannot be used together with the GROUP BY clause.

docs/zh/05-basic/03-query.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ window_clause: {
170170
**注意** 在使用窗口子句时应注意以下规则(以下规则适用于 SESSION、STATE_WINDOW、INTERVAL、EVENT_WINDOW、COUNT_WINDOW 五种窗口,EXTERNAL_WINDOW 的规则有所不同,详见[外部窗口](#外部窗口)章节):
171171

172172
1. 窗口子句位于数据切分子句之后,不可以和 GROUP BY 子句一起使用。
173-
2. 窗口子句将数据按窗口进行切分,对每个窗口进行 SELECT 列表中的表达式的计算,SELECT 列表中的表达式只能包含:常量;伪列:_wstart、_wend 和 _wduration;聚合函数:包括选择函数和可以由参数确定输出行数的时序特有函数
173+
2. 窗口子句将数据按窗口进行切分,对每个窗口进行 SELECT 列表中的表达式的计算,SELECT 列表中的表达式只能包含:常量;伪列:_wstart、_wend 和 _wduration;聚合函数:包括选择函数、可以由参数确定输出行数的时序特有函数,以及时序函数中的窗口计算和时间加权统计函数
174174
3. WHERE 语句可以指定查询的起止时间和其他过滤条件。
175175

176176
### 时间戳伪列

docs/zh/14-reference/03-taos-sql/22-function.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2369,11 +2369,11 @@ LAG(expr, offset[, default_val])
23692369
**使用说明**
23702370

23712371
- `offset` 必须为大于 0 的整数。
2372-
- `default_val` 可选;当目标行不存在时返回该值,未指定时返回 `NULL`
2373-
- `default_val` 需要与 `expr` 类型兼容。
2374-
- `LAG` 按输入结果集的行序计算;可以结合 `ORDER BY` 改变计算顺序。
2375-
- 支持与 `_rowts``tbname`、标签列等一起查询,也支持在子查询和 `PARTITION BY` 场景中使用。
2376-
- 不支持窗口查询(例如 `INTERVAL``SESSION``STATE_WINDOW` 等)
2372+
- `default_val` 可选;当目标行不存在时返回该值,未指定时返回 `NULL`
2373+
- `default_val` 需要与 `expr` 类型兼容。
2374+
- `LAG` 按输入结果集的行序计算;可以结合 `ORDER BY` 改变计算顺序。
2375+
- 支持与 `_rowts``tbname`、标签列等一起查询,也支持在子查询和 `PARTITION BY` 场景中使用。
2376+
- 与窗口一起使用时,`LAG` 仅在当前窗口内部按窗口内结果顺序计算,不会跨窗口继承上一窗口的状态
23772377

23782378
#### LEAD
23792379

@@ -2392,11 +2392,11 @@ LEAD(expr, offset[, default_val])
23922392
**使用说明**
23932393

23942394
- `offset` 必须为大于 0 的整数。
2395-
- `default_val` 可选;当目标行不存在时返回该值,未指定时返回 `NULL`
2396-
- `default_val` 需要与 `expr` 类型兼容。
2397-
- `LEAD` 按输入结果集的行序计算;可以结合 `ORDER BY` 改变计算顺序。
2398-
- 支持与 `_rowts``tbname`、标签列等一起查询,也支持在子查询和 `PARTITION BY` 场景中使用。
2399-
- 不支持窗口查询(例如 `INTERVAL``SESSION``STATE_WINDOW` 等)
2395+
- `default_val` 可选;当目标行不存在时返回该值,未指定时返回 `NULL`
2396+
- `default_val` 需要与 `expr` 类型兼容。
2397+
- `LEAD` 按输入结果集的行序计算;可以结合 `ORDER BY` 改变计算顺序。
2398+
- 支持与 `_rowts``tbname`、标签列等一起查询,也支持在子查询和 `PARTITION BY` 场景中使用。
2399+
- 与窗口一起使用时,`LEAD` 仅在当前窗口内部按窗口内结果顺序计算,不会跨窗口读取下一窗口的数据
24002400

24012401
#### MAX
24022402

@@ -3155,10 +3155,11 @@ MAVG(expr, k)
31553155

31563156
**适用于**:表和超级表。
31573157

3158-
**使用说明**
3159-
3160-
- 不支持 +、-、*、/ 运算,如 mavg(col1, k1) + mavg(col2, k1);
3161-
- 只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用;
3158+
**使用说明**
3159+
3160+
- 不支持 +、-、*、/ 运算,如 mavg(col1, k1) + mavg(col2, k1);
3161+
- 只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用;
3162+
- 与窗口一起使用时,`MAVG` 仅在当前窗口内部按样本顺序计算,不会跨窗口延续上一窗口的样本状态。
31623163

31633164
#### STATECOUNT
31643165

@@ -3181,9 +3182,9 @@ STATECOUNT(expr, oper, val)
31813182

31823183
**适用于**:表和超级表。
31833184

3184-
**使用说明**
3185-
3186-
- 不能和窗口操作一起使用,例如 `interval/state_window/session_window`
3185+
**使用说明**
3186+
3187+
- 与窗口一起使用时,`STATECOUNT` 仅统计当前窗口内部的连续记录,不会跨窗口累计
31873188

31883189
#### STATEDURATION
31893190

@@ -3207,9 +3208,9 @@ STATEDURATION(expr, oper, val, unit)
32073208

32083209
**适用于**:表和超级表。
32093210

3210-
**使用说明**
3211-
3212-
- 不能和窗口操作一起使用,例如 interval、state_window、session_window
3211+
**使用说明**
3212+
3213+
- 与窗口一起使用时,`STATEDURATION` 仅统计当前窗口内部满足条件的连续时长,不会跨窗口累计
32133214

32143215
### 时间加权统计
32153216

docs/zh/14-reference/03-taos-sql/24-distinguished.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ window_clause: {
6969
- 窗口子句将数据按窗口进行切分,对每个窗口进行 SELECT 列表中的表达式的计算,SELECT 列表中的表达式只能包含:
7070
- 常量。
7171
- _wstart 伪列、_wend 伪列和_wduration 伪列。
72-
- 聚集函数(包括选择函数和可以由参数确定输出行数的时序特有函数)。
72+
- 聚集函数(包括选择函数、可以由参数确定输出行数的时序特有函数,以及时序函数中的窗口计算和时间加权统计函数)。
7373
- 包含上面表达式的表达式。
7474
- 且至少包含一个聚集函数 (3.4.0.0 之后不再有该限制)。
7575
- 窗口子句不可以和 GROUP BY 子句一起使用。

0 commit comments

Comments
 (0)