From 7701943d31ae6f8b697b1390aab248bb05148052 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Wed, 8 Nov 2023 19:24:03 +0800 Subject: [PATCH 1/4] add doc for using default unit of interval --- docs/en/12-taos-sql/12-distinguished.md | 12 +++++++++++- docs/zh/12-taos-sql/12-distinguished.md | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) 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')`, 第一种形式也可用引号括起来. 必须指定单位, 内部不能有任何空格. + 在上述语法中的具体限制如下 ### 窗口子句的规则 From 9002f4ad027501f05ce1be936a08ef5691df38d5 Mon Sep 17 00:00:00 2001 From: dapan1121 <72057773+dapan1121@users.noreply.github.com> Date: Thu, 9 Nov 2023 08:45:28 +0800 Subject: [PATCH 2/4] Update 12-distinguished.md --- docs/zh/12-taos-sql/12-distinguished.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/docs/zh/12-taos-sql/12-distinguished.md b/docs/zh/12-taos-sql/12-distinguished.md index ac0ec40b9d..f9a0c23e8f 100755 --- a/docs/zh/12-taos-sql/12-distinguished.md +++ b/docs/zh/12-taos-sql/12-distinguished.md @@ -39,17 +39,12 @@ TDengine 支持按时间窗口切分方式进行聚合结果查询,比如温 window_clause: { SESSION(ts_col, tol_val) | STATE_WINDOW(col) - | INTERVAL(interval_val [, interval_offset]) [SLIDING (interval_val)] [FILL(fill_mod_and_val)] + | INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_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_val 和 sliding_val 都表示时间段, 语法上支持三种方式,举例说明如下: - `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')`, 第一种形式也可用引号括起来. 必须指定单位, 内部不能有任何空格. From ae6aef3fdc5ec69134c74a4eb9504fb4b6958a4f Mon Sep 17 00:00:00 2001 From: dapan1121 <72057773+dapan1121@users.noreply.github.com> Date: Thu, 9 Nov 2023 08:50:55 +0800 Subject: [PATCH 3/4] Update 12-distinguished.md --- docs/zh/12-taos-sql/12-distinguished.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/zh/12-taos-sql/12-distinguished.md b/docs/zh/12-taos-sql/12-distinguished.md index f9a0c23e8f..98bfd3567a 100755 --- a/docs/zh/12-taos-sql/12-distinguished.md +++ b/docs/zh/12-taos-sql/12-distinguished.md @@ -45,11 +45,10 @@ window_clause: { ``` 其中,interval_val 和 sliding_val 都表示时间段, 语法上支持三种方式,举例说明如下: - - `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')`, 第一种形式也可用引号括起来. 必须指定单位, 内部不能有任何空格. + - 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'), 自带时间单位的字符串形式,字符串内部不能有任何空格等其它字符. -在上述语法中的具体限制如下 ### 窗口子句的规则 From d6d8bfe685eee153269fede774a7b5de7ac67842 Mon Sep 17 00:00:00 2001 From: dapan1121 <72057773+dapan1121@users.noreply.github.com> Date: Thu, 9 Nov 2023 08:57:07 +0800 Subject: [PATCH 4/4] Update 12-distinguished.md --- docs/en/12-taos-sql/12-distinguished.md | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/docs/en/12-taos-sql/12-distinguished.md b/docs/en/12-taos-sql/12-distinguished.md index 328fb62bf3..502b7562f3 100644 --- a/docs/en/12-taos-sql/12-distinguished.md +++ b/docs/en/12-taos-sql/12-distinguished.md @@ -38,20 +38,15 @@ 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 (interval)] [FILL({NONE | VALUE | PREV | NULL | LINEAR | NEXT})] + | INTERVAL(interval_val [, offset]) [SLIDING (sliding_value)] [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. +Both interval_val and sliding_value are time durations which have 3 forms of representation. +- INTERVAL(1s, 500a) SLIDING(1s), the unit char should be any 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 queried database, if there are more than one databases, higher precision will be used. +- INTERVAL('1s', '500a') SLIDING('1s'), unit must be specified, no spaces allowed. The following restrictions apply: