diff --git a/docs/en/12-taos-sql/12-distinguished.md b/docs/en/12-taos-sql/12-distinguished.md index 7f0b8c7769..328fb62bf3 100644 --- a/docs/en/12-taos-sql/12-distinguished.md +++ b/docs/en/12-taos-sql/12-distinguished.md @@ -38,11 +38,21 @@ Aggregation by time window is supported in TDengine. For example, in the case wh window_clause: { SESSION(ts_col, tol_val) | STATE_WINDOW(col) - | INTERVAL(interval [, offset]) [SLIDING sliding] [FILL({NONE | VALUE | PREV | NULL | LINEAR | NEXT})] + | INTERVAL(interval [, offset]) [SLIDING (interval)] [FILL({NONE | VALUE | PREV | NULL | LINEAR | NEXT})] | EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition } +interval: + TK_NUMBER + | TK_STRING + | TK_DURATION ``` +The parameters of INTERVAL(`interval` or `offset`) and SLIDING are time durations which have 3 forms of representation. + +- `INTERVAL(1s, 500a) SLIDING(1s)`, the unit char should be one of `a (millisecond), b (nanosecond), d (day), h (hour), m (minute), n (month), s (second), u (microsecond), w (week), y (year)`. +- `INTERVAL(1000, 500) SLIDING(1000)`, the unit will the same as the database. +- `INTERVAL('1s', '500a') SLIDING('1s')`, or double quoted. Unit must be specified, no spaces allowed. + The following restrictions apply: ### Other Rules diff --git a/docs/zh/12-taos-sql/12-distinguished.md b/docs/zh/12-taos-sql/12-distinguished.md index 62888cc5f7..ac0ec40b9d 100755 --- a/docs/zh/12-taos-sql/12-distinguished.md +++ b/docs/zh/12-taos-sql/12-distinguished.md @@ -39,11 +39,21 @@ TDengine 支持按时间窗口切分方式进行聚合结果查询,比如温 window_clause: { SESSION(ts_col, tol_val) | STATE_WINDOW(col) - | INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [FILL(fill_mod_and_val)] + | INTERVAL(interval_val [, interval_offset]) [SLIDING (interval_val)] [FILL(fill_mod_and_val)] | EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition } +interval_val: + TK_NUMBER + | TK_STRING + | TK_DURATION ``` +INTERVAL和SLIDING的参数都表示时间段, 有三种表示方式: + + - `INTERVAL(1s, 500a) SLIDING(1s)`, 单位是单字符表示, 分别为: `a (毫秒), b (纳秒), d (天), h (小时), m (分钟), n (月), s (秒), u (微妙), w (周), y (年)`. + - `INTERVAL(1000, 500) SLIDING(1000)`, 不带单位的形式使用默认单位, 为表所在库的单位. + - `INTERVAL('1s', '500a') SLIDING('1s')`, 第一种形式也可用引号括起来. 必须指定单位, 内部不能有任何空格. + 在上述语法中的具体限制如下 ### 窗口子句的规则