diff --git a/cmake/cmake.version b/cmake/cmake.version index d0d455c73dc3bbb5109fc701855d0efaa7c24db7..d38ac40b90c932b41717d6d16dadc176a842a2b2 100644 --- a/cmake/cmake.version +++ b/cmake/cmake.version @@ -2,7 +2,7 @@ IF (DEFINED VERNUMBER) SET(TD_VER_NUMBER ${VERNUMBER}) ELSE () - SET(TD_VER_NUMBER "3.0.2.6") + SET(TD_VER_NUMBER "3.0.3.0") ENDIF () IF (DEFINED VERCOMPATIBLE) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index aecb8a1750220bb0432d2bc8f5b4c503ccd59022..5fe8f6ea13801d2ce04caef45854f36fd030a3cb 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG 0111c66 + GIT_TAG d4b3967 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE diff --git a/docs/en/12-taos-sql/12-distinguished.md b/docs/en/12-taos-sql/12-distinguished.md index 5afa81daac6a19b7306207ec0e441e6d086e50d5..1edae160268d39b48b8df7b371ab3762d87cb005 100644 --- a/docs/en/12-taos-sql/12-distinguished.md +++ b/docs/en/12-taos-sql/12-distinguished.md @@ -32,15 +32,15 @@ The most common usage of PARTITION BY is partitioning the data in subtables by t ## Windowed Queries -Aggregation by time window is supported in TDengine. For example, in the case where temperature sensors report the temperature every seconds, the average temperature for every 10 minutes can be retrieved by performing a query with a time window. Window related clauses are used to divide the data set to be queried into subsets and then aggregation is performed across the subsets. There are three kinds of windows: time window, status window, and session window. There are two kinds of time windows: sliding window and flip time/tumbling window. The query syntax is as follows: +Aggregation by time window is supported in TDengine. For example, in the case where temperature sensors report the temperature every seconds, the average temperature for every 10 minutes can be retrieved by performing a query with a time window. Window related clauses are used to divide the data set to be queried into subsets and then aggregation is performed across the subsets. There are four kinds of windows: time window, status window, session window, and event window. There are two kinds of time windows: sliding window and flip time/tumbling window. The syntax of window clause is as follows: ```sql -SELECT select_list FROM tb_name - [WHERE where_condition] - [SESSION(ts_col, tol_val)] - [STATE_WINDOW(col)] - [INTERVAL(interval [, offset]) [SLIDING sliding]] - [FILL({NONE | VALUE | PREV | NULL | LINEAR | NEXT})] +window_clause: { + SESSION(ts_col, tol_val) + | STATE_WINDOW(col) + | INTERVAL(interval [, offset]) [SLIDING sliding] [FILL({NONE | VALUE | PREV | NULL | LINEAR | NEXT})] + | EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition +} ``` The following restrictions apply: @@ -146,6 +146,26 @@ If the time interval between two continuous rows are within the time interval sp SELECT COUNT(*), FIRST(ts) FROM temp_tb_1 SESSION(ts, tol_val); ``` +### Event Window + +Event window is determined according to the window start condition and the window close condition. The window is started when `start_trigger_condition` is evaluated to true, the window is closed when `end_trigger_condition` is evaluated to true. `start_trigger_condition` and `end_trigger_condition` can be any conditional expressions supported by TDengine and can include multiple columns. + +There may be only one row of data in an event window, when a row meets both the `start_trigger_condition` and the `end_trigger_condition`. + +The window is treated as invalid or non-existing if the `end_trigger_condition` can't be met. There will be no output in case that a window can't be closed. + +If the event window query is performed on a super table, TDengine consolidates all the data of all child tables into a single timeline then perform event window based query. + +If you want to perform event window based query on the result set of a sub-query, the result set of the sub-query should be arranged in the order of timestamp and include the column of timestamp. + +For example, the diagram below illustrates the event windows generated by the query below: + +```sql +select _wstart, _wend, count(*) from t start with c1 > 0 end with c2 < 10 +``` + +![Event Window Illustration](./event_window.webp) + ### Examples A table of intelligent meters can be created by the SQL statement below: diff --git a/docs/en/12-taos-sql/event_window.webp b/docs/en/12-taos-sql/event_window.webp new file mode 100644 index 0000000000000000000000000000000000000000..0a3a344b03194f245aa879b801fa4edb38f85445 Binary files /dev/null and b/docs/en/12-taos-sql/event_window.webp differ diff --git a/docs/en/14-reference/05-taosbenchmark.md b/docs/en/14-reference/05-taosbenchmark.md index 3dd8339ad4e75782ddfd447a6614998d8db01a34..bfb311d72e180990870eb40726aeb6c1f996200f 100644 --- a/docs/en/14-reference/05-taosbenchmark.md +++ b/docs/en/14-reference/05-taosbenchmark.md @@ -210,6 +210,9 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\) - **-z/--trying-interval ** : Specify interval between keep trying insert. Valid value is a positive number. Only valid when keep trying be enabled. Available with v3.0.9+. +- **-v/--vgroups ** : + Specify vgroups number for creating a database, only valid with daemon version 3.0+ + - **-V/--version** : Show version information only. Users should not use it with other parameters. @@ -241,6 +244,14 @@ The parameters listed in this section apply to all function modes. - ** trying_interval ** : Specify interval between keep trying insert. Valid value is a positive number. Only valid when keep trying be enabled. Available with v3.0.9+. +- ** childtable_from and childtable_to ** : specify the child table range to create. The range is [childtable_from, childtable_to). +  +- ** continue_if_fail ** : allow the user to specify the reaction if the insertion failed. + + - "continue_if_fail" : "no" // means taosBenchmark will exit if it fails to insert as default reaction behavior. + - "continue_if_fail" : "yes" // means taosBenchmark will warn the user if it fails to insert but continue to insert the next record. + - "continue_if_fail": "smart" // means taosBenchmark will try to create the non-existent child table if it fails to insert. + #### Database related configuration parameters The parameters related to database creation are configured in `dbinfo` in the json configuration file, as follows. The other parameters correspond to the database parameters specified when `create database` in [../../taos-sql/database]. diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md index 6a6210806274d5b6e2e8efe12d281e908d2d0c96..088c4ba2dcd5f2e6cd4fce789d9d24db8ab006e8 100644 --- a/docs/en/28-releases/01-tdengine.md +++ b/docs/en/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://w import Release from "/components/ReleaseV3"; +## 3.0.3.0 + + + ## 3.0.2.6 diff --git a/docs/en/28-releases/02-tools.md b/docs/en/28-releases/02-tools.md index 91eb0c9b8d1ee5ed3b0e774c3d2d78e3bd4c03ba..a8a5c7af6f01a4eb5282fe91051ca69e311de96d 100644 --- a/docs/en/28-releases/02-tools.md +++ b/docs/en/28-releases/02-tools.md @@ -10,6 +10,10 @@ For other historical version installers, please visit [here](https://www.taosdat import Release from "/components/ReleaseV3"; +## 2.4.8 + + + ## 2.4.6 diff --git a/docs/zh/12-taos-sql/12-distinguished.md b/docs/zh/12-taos-sql/12-distinguished.md index d36c852e7975dbe602166d8c7d12027043c2e302..53689197efa1fa2b03ddc60868168d092064f014 100644 --- a/docs/zh/12-taos-sql/12-distinguished.md +++ b/docs/zh/12-taos-sql/12-distinguished.md @@ -31,15 +31,17 @@ select max(current) from meters partition by location interval(10m) ## 窗口切分查询 -TDengine 支持按时间窗口切分方式进行聚合结果查询,比如温度传感器每秒采集一次数据,但需查询每隔 10 分钟的温度平均值。这种场景下可以使用窗口子句来获得需要的查询结果。窗口子句用于针对查询的数据集合按照窗口切分成为查询子集并进行聚合,窗口包含时间窗口(time window)、状态窗口(status window)、会话窗口(session window)三种窗口。其中时间窗口又可划分为滑动时间窗口和翻转时间窗口。窗口切分查询语法如下: +TDengine 支持按时间窗口切分方式进行聚合结果查询,比如温度传感器每秒采集一次数据,但需查询每隔 10 分钟的温度平均值。这种场景下可以使用窗口子句来获得需要的查询结果。窗口子句用于针对查询的数据集合按照窗口切分成为查询子集并进行聚合,窗口包含时间窗口(time window)、状态窗口(status window)、会话窗口(session window)、条件窗口(event window)四种窗口。其中时间窗口又可划分为滑动时间窗口和翻转时间窗口。 + +窗口子句语法如下: ```sql -SELECT select_list FROM tb_name - [WHERE where_condition] - [SESSION(ts_col, tol_val)] - [STATE_WINDOW(col)] - [INTERVAL(interval [, offset]) [SLIDING sliding]] - [FILL({NONE | VALUE | PREV | NULL | LINEAR | NEXT})] +window_clause: { + SESSION(ts_col, tol_val) + | STATE_WINDOW(col) + | 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 +} ``` 在上述语法中的具体限制如下 @@ -138,6 +140,24 @@ SELECT tbname, _wstart, CASE WHEN voltage >= 205 and voltage <= 235 THEN 1 ELSE SELECT COUNT(*), FIRST(ts) FROM temp_tb_1 SESSION(ts, tol_val); ``` +### 事件窗口 + +事件窗口根据开始条件和结束条件来划定窗口,当start_trigger_condition满足时则窗口开始,直到end_trigger_condition满足时窗口关闭。start_trigger_condition和end_trigger_condition可以是任意 TDengine 支持的条件表达式,且可以包含不同的列。 + +事件窗口可以仅包含一条数据。即当一条数据同时满足start_trigger_condition和end_trigger_condition,且当前不在一个窗口内时,这条数据自己构成了一个窗口。 + +事件窗口无法关闭时,不构成一个窗口,不会被输出。即有数据满足start_trigger_condition,此时窗口打开,但后续数据都不能满足end_trigger_condition,这个窗口无法被关闭,这部分数据不够成一个窗口,不会被输出。 + +如果直接在超级表上进行事件窗口查询,TDengine 会将超级表的数据汇总成一条时间线,然后进行事件窗口的计算。 +如果需要对子查询的结果集进行事件窗口查询,那么子查询的结果集需要满足按时间线输出的要求,且可以输出有效的时间戳列。 + +以下面的 SQL 语句为例,事件窗口切分如图所示: +```sql +select _wstart, _wend, count(*) from t start with c1 > 0 end with c2 < 10 +``` + +![TDengine Database 事件窗口示意图](./event_window.webp) + ### 时间戳伪列 窗口聚合查询结果中,如果 SQL 语句中没有指定输出查询结果中的时间戳列,那么最终结果中不会自动包含窗口的时间列信息。如果需要在结果中输出聚合结果所对应的时间窗口信息,需要在 SELECT 子句中使用时间戳相关的伪列: 时间窗口起始时间 (\_WSTART), 时间窗口结束时间 (\_WEND), 时间窗口持续时间 (\_WDURATION), 以及查询整体窗口相关的伪列: 查询窗口起始时间(\_QSTART) 和查询窗口结束时间(\_QEND)。需要注意的是时间窗口起始时间和结束时间均是闭区间,时间窗口持续时间是数据当前时间分辨率下的数值。例如,如果当前数据库的时间分辨率是毫秒,那么结果中 500 就表示当前时间窗口的持续时间是 500毫秒 (500 ms)。 diff --git a/docs/zh/12-taos-sql/event_window.webp b/docs/zh/12-taos-sql/event_window.webp new file mode 100644 index 0000000000000000000000000000000000000000..6d2ac0820433ecb89f3e22f7070b94aa0635c885 Binary files /dev/null and b/docs/zh/12-taos-sql/event_window.webp differ diff --git a/docs/zh/14-reference/05-taosbenchmark.md b/docs/zh/14-reference/05-taosbenchmark.md index 9091e71d1f9b118660d5f75ef9be5627143393b0..e2e51efec56fbf6ad312783c71bb9fe4f99043e6 100644 --- a/docs/zh/14-reference/05-taosbenchmark.md +++ b/docs/zh/14-reference/05-taosbenchmark.md @@ -208,6 +208,9 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\) - ** -z/--trying-interval ** : 失败重试间隔时间,单位为毫秒,仅在 -k 指定重试后有效。需使用 v3.0.9 以上版本。 +- **-v/--vgroups ** : + 创建数据库时指定 vgroups 数,仅对 TDengine v3.0+ 有效。 + - **-V/--version** : 显示版本信息并退出。不能与其它参数混用。 @@ -238,6 +241,13 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\) - ** keep_trying ** : 失败后进行重试的次数,默认不重试。需使用 v3.0.9 以上版本。 - ** trying_interval ** : 失败重试间隔时间,单位为毫秒,仅在 keep_trying 指定重试后有效。需使用 v3.0.9 以上版本。 +- ** childtable_from 和 childtable_to ** : 指定写入子表范围,开闭区间为 [childtable_from, childtable_to). +  +- ** continue_if_fail ** : 允许用户定义失败后行为 + + “continue_if_fail”:  “no”, 失败 taosBenchmark 自动退出,默认行为 + “continue_if_fail”: “yes”, 失败 taosBenchmark 警告用户,并继续写入 + “continue_if_fail”: “smart”, 如果子表不存在失败,taosBenchmark 会建立子表并继续写入 #### 数据库相关配置参数 diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md index c9505d95a58ef03d5d374d952c4b66c3d5e37828..5c8c5edd0519764ec893b551a2dfc934ad44e5c4 100644 --- a/docs/zh/28-releases/01-tdengine.md +++ b/docs/zh/28-releases/01-tdengine.md @@ -10,6 +10,11 @@ TDengine 2.x 各版本安装包请访问[这里](https://www.taosdata.com/all-do import Release from "/components/ReleaseV3"; +## 3.0.3.0 + + + + ## 3.0.2.6 diff --git a/docs/zh/28-releases/02-tools.md b/docs/zh/28-releases/02-tools.md index 69d35f95c85c743b7f0f0ff035c23ed96c26b021..a69c901fcb156ffaa2ba3bcd7ed6bf51422205dc 100644 --- a/docs/zh/28-releases/02-tools.md +++ b/docs/zh/28-releases/02-tools.md @@ -10,6 +10,10 @@ taosTools 各版本安装包下载链接如下: import Release from "/components/ReleaseV3"; +## 2.4.8 + + + ## 2.4.6