From fe4902e6cb079bb296d621374885621d4980a4c4 Mon Sep 17 00:00:00 2001 From: Linxt20 Date: Thu, 14 Dec 2023 12:46:02 +0800 Subject: [PATCH 1/3] add_and_change_show_devices_Template_column --- src/zh/UserGuide/Master/API/RestServiceV1.md | 14 ++- src/zh/UserGuide/Master/API/RestServiceV2.md | 14 ++- .../UserGuide/Master/SQL-Manual/SQL-Manual.md | 6 ++ .../Master/User-Manual/Operate-Metadata.md | 96 ++++++++++--------- .../Master/stage/Operate-Metadata/Node.md | 86 ++++++++++------- .../Master/stage/Operate-Metadata/Template.md | 12 +-- 6 files changed, 138 insertions(+), 90 deletions(-) diff --git a/src/zh/UserGuide/Master/API/RestServiceV1.md b/src/zh/UserGuide/Master/API/RestServiceV1.md index 06339cb8..b58a71ec 100644 --- a/src/zh/UserGuide/Master/API/RestServiceV1.md +++ b/src/zh/UserGuide/Master/API/RestServiceV1.md @@ -528,7 +528,8 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X "expressions": null, "columnNames": [ "devices", - "isAligned" + "isAligned", + "Template" ], "timestamps": null, "values": [ @@ -539,6 +540,10 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X [ "false", "false" + ], + [ + "t1", + "null" ] ] } @@ -557,7 +562,8 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X "columnNames": [ "devices", "database", - "isAligned" + "isAligned", + "Template" ], "timestamps": null, "values": [ @@ -572,6 +578,10 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X [ "false", "false" + ], + [ + "t1", + "null" ] ] } diff --git a/src/zh/UserGuide/Master/API/RestServiceV2.md b/src/zh/UserGuide/Master/API/RestServiceV2.md index d88f10ee..37c3c3a5 100644 --- a/src/zh/UserGuide/Master/API/RestServiceV2.md +++ b/src/zh/UserGuide/Master/API/RestServiceV2.md @@ -528,7 +528,8 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X "expressions": null, "column_names": [ "devices", - "isAligned" + "isAligned", + "Template" ], "timestamps": null, "values": [ @@ -539,6 +540,10 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X [ "false", "false" + ], + [ + "t1", + "null" ] ] } @@ -557,7 +562,8 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X "column_names": [ "devices", "database", - "isAligned" + "isAligned", + "Template" ], "timestamps": null, "values": [ @@ -572,6 +578,10 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X [ "false", "false" + ], + [ + "t1", + "null" ] ] } diff --git a/src/zh/UserGuide/Master/SQL-Manual/SQL-Manual.md b/src/zh/UserGuide/Master/SQL-Manual/SQL-Manual.md index ed42eec3..2d35bf74 100644 --- a/src/zh/UserGuide/Master/SQL-Manual/SQL-Manual.md +++ b/src/zh/UserGuide/Master/SQL-Manual/SQL-Manual.md @@ -306,6 +306,12 @@ IoTDB> show paths using schema template t1 IoTDB> show devices using schema template t1 +IoTDB> show devices where template = t1 + +- 查看没有使用指定元数据模板的路径 + +IoTDB> show devices where template != t1 + #### 解除元数据模板 IoTDB> delete timeseries of schema template t1 from root.sg1.d1 diff --git a/src/zh/UserGuide/Master/User-Manual/Operate-Metadata.md b/src/zh/UserGuide/Master/User-Manual/Operate-Metadata.md index a5212612..6c8e97dd 100644 --- a/src/zh/UserGuide/Master/User-Manual/Operate-Metadata.md +++ b/src/zh/UserGuide/Master/User-Manual/Operate-Metadata.md @@ -381,12 +381,12 @@ show devices root.sg1.** ``` ```shell -+---------------+---------+ -| devices|isAligned| -+---------------+---------+ -| root.sg1.d1| false| -| root.sg1.d2| true| -+---------------+---------+ ++---------------+---------+---------+ +| devices|isAligned| Template| ++---------------+---------+---------+ +| root.sg1.d1| false| null| +| root.sg1.d2| true| null| ++---------------+---------+---------+ ``` ### 查看元数据模板 @@ -1072,33 +1072,43 @@ SQL 语句如下所示: IoTDB> show devices IoTDB> show devices root.ln.** IoTDB> show devices root.ln.** where device contains 't' +IoTDB> show devices root.ln.** where template = "t1" ``` 你可以获得如下数据: ``` -+-------------------+---------+ -| devices|isAligned| -+-------------------+---------+ -| root.ln.wf01.wt01| false| -| root.ln.wf02.wt02| false| -|root.sgcc.wf03.wt01| false| -| root.turbine.d1| false| -+-------------------+---------+ ++-------------------+---------+---------+ +| devices|isAligned| Template| ++-------------------+---------+---------+ +| root.ln.wf01.wt01| false| t1| +| root.ln.wf02.wt02| false| null| +|root.sgcc.wf03.wt01| false| null| +| root.turbine.d1| false| null| ++-------------------+---------+---------+ Total line number = 4 It costs 0.002s -+-----------------+---------+ -| devices|isAligned| -+-----------------+---------+ -|root.ln.wf01.wt01| false| -|root.ln.wf02.wt02| false| -+-----------------+---------+ ++-----------------+---------+---------+ +| devices|isAligned| Template| ++-----------------+---------+---------+ +|root.ln.wf01.wt01| false| t1| +|root.ln.wf02.wt02| false| null| ++-----------------+---------+---------+ Total line number = 2 It costs 0.001s + ++-----------------+---------+---------+ +| devices|isAligned| Template| ++-----------------+---------+---------+ +|root.ln.wf01.wt01| false| t1| ++-----------------+---------+---------+ +Total line number = 1 +It costs 0.001s ``` -其中,`isAligned`表示该设备下的时间序列是否对齐。 +其中,`isAligned`表示该设备下的时间序列是否对齐, +`Template`显示着该设备所激活的模板名,null 表示没有激活模板。 查看设备及其 database 信息,可以使用 `SHOW DEVICES WITH DATABASE` 语句。 @@ -1115,23 +1125,23 @@ IoTDB> show devices root.ln.** with database 你可以获得如下数据: ``` -+-------------------+-------------+---------+ -| devices| database|isAligned| -+-------------------+-------------+---------+ -| root.ln.wf01.wt01| root.ln| false| -| root.ln.wf02.wt02| root.ln| false| -|root.sgcc.wf03.wt01| root.sgcc| false| -| root.turbine.d1| root.turbine| false| -+-------------------+-------------+---------+ ++-------------------+-------------+---------+---------+ +| devices| database|isAligned| Template| ++-------------------+-------------+---------+---------+ +| root.ln.wf01.wt01| root.ln| false| t1| +| root.ln.wf02.wt02| root.ln| false| null| +|root.sgcc.wf03.wt01| root.sgcc| false| null| +| root.turbine.d1| root.turbine| false| null| ++-------------------+-------------+---------+---------+ Total line number = 4 It costs 0.003s -+-----------------+-------------+---------+ -| devices| database|isAligned| -+-----------------+-------------+---------+ -|root.ln.wf01.wt01| root.ln| false| -|root.ln.wf02.wt02| root.ln| false| -+-----------------+-------------+---------+ ++-----------------+-------------+---------+---------+ +| devices| database|isAligned| Template| ++-----------------+-------------+---------+---------+ +|root.ln.wf01.wt01| root.ln| false| t1| +|root.ln.wf02.wt02| root.ln| false| null| ++-----------------+-------------+---------+---------+ Total line number = 2 It costs 0.001s ``` @@ -1153,14 +1163,14 @@ IoTDB> count devices root.ln.** 你可以获得如下数据: ``` -+-------------------+---------+ -| devices|isAligned| -+-------------------+---------+ -|root.sgcc.wf03.wt03| false| -| root.turbine.d1| false| -| root.ln.wf02.wt02| false| -| root.ln.wf01.wt01| false| -+-------------------+---------+ ++-------------------+---------+---------+ +| devices|isAligned| Template| ++-------------------+---------+---------+ +|root.sgcc.wf03.wt03| false| null| +| root.turbine.d1| false| null| +| root.ln.wf02.wt02| false| null| +| root.ln.wf01.wt01| false| t1| ++-------------------+---------+---------+ Total line number = 4 It costs 0.024s diff --git a/src/zh/UserGuide/Master/stage/Operate-Metadata/Node.md b/src/zh/UserGuide/Master/stage/Operate-Metadata/Node.md index e0545200..7ee140b4 100644 --- a/src/zh/UserGuide/Master/stage/Operate-Metadata/Node.md +++ b/src/zh/UserGuide/Master/stage/Operate-Metadata/Node.md @@ -147,6 +147,8 @@ It costs 0.002s * `SHOW DEVICES` 语句显示当前所有的设备信息,等价于 `SHOW DEVICES root.**`。 * `SHOW DEVICES ` 语句规定了 `PathPattern`,返回给定的路径模式所匹配的设备信息。 * `WHERE` 条件中可以使用 `DEVICE contains 'xxx'`,根据 device 名称进行模糊查询。 +* `WHERE` 条件中可以使用 `TEMPLATE = 'xxx'`,`TEMPLATE != 'xxx'`,根据 template 名称进行过滤查询。 + SQL 语句如下所示: @@ -154,33 +156,43 @@ SQL 语句如下所示: IoTDB> show devices IoTDB> show devices root.ln.** IoTDB> show devices root.ln.** where device contains 't' +IoTDB> show devices root.ln.** where template = "t1" ``` 你可以获得如下数据: ``` -+-------------------+---------+ -| devices|isAligned| -+-------------------+---------+ -| root.ln.wf01.wt01| false| -| root.ln.wf02.wt02| false| -|root.sgcc.wf03.wt01| false| -| root.turbine.d1| false| -+-------------------+---------+ ++-------------------+---------+---------+ +| devices|isAligned| Template| ++-------------------+---------+---------+ +| root.ln.wf01.wt01| false| t1| +| root.ln.wf02.wt02| false| null| +|root.sgcc.wf03.wt01| false| null| +| root.turbine.d1| false| null| ++-------------------+---------+---------+ Total line number = 4 It costs 0.002s -+-----------------+---------+ -| devices|isAligned| -+-----------------+---------+ -|root.ln.wf01.wt01| false| -|root.ln.wf02.wt02| false| -+-----------------+---------+ ++-----------------+---------+---------+ +| devices|isAligned| Template| ++-----------------+---------+---------+ +|root.ln.wf01.wt01| false| t1| +|root.ln.wf02.wt02| false| null| ++-----------------+---------+---------+ Total line number = 2 It costs 0.001s + ++-----------------+---------+---------+ +| devices|isAligned| Template| ++-----------------+---------+---------+ +|root.ln.wf01.wt01| false| t1| ++-----------------+---------+---------+ +Total line number = 1 +It costs 0.001s ``` -其中,`isAligned`表示该设备下的时间序列是否对齐。 +其中,`isAligned`表示该设备下的时间序列是否对齐, +`Template`显示着该设备所激活的模板名,null 表示没有激活模板。 查看设备及其 database 信息,可以使用 `SHOW DEVICES WITH DATABASE` 语句。 @@ -197,23 +209,23 @@ IoTDB> show devices root.ln.** with database 你可以获得如下数据: ``` -+-------------------+-------------+---------+ -| devices| database|isAligned| -+-------------------+-------------+---------+ -| root.ln.wf01.wt01| root.ln| false| -| root.ln.wf02.wt02| root.ln| false| -|root.sgcc.wf03.wt01| root.sgcc| false| -| root.turbine.d1| root.turbine| false| -+-------------------+-------------+---------+ ++-------------------+-------------+---------+---------+ +| devices| database|isAligned| Template| ++-------------------+-------------+---------+---------+ +| root.ln.wf01.wt01| root.ln| false| t1| +| root.ln.wf02.wt02| root.ln| false| null| +|root.sgcc.wf03.wt01| root.sgcc| false| null| +| root.turbine.d1| root.turbine| false| null| ++-------------------+-------------+---------+---------+ Total line number = 4 It costs 0.003s -+-----------------+-------------+---------+ -| devices| database|isAligned| -+-----------------+-------------+---------+ -|root.ln.wf01.wt01| root.ln| false| -|root.ln.wf02.wt02| root.ln| false| -+-----------------+-------------+---------+ ++-----------------+-------------+---------+---------+ +| devices| database|isAligned| Template| ++-----------------+-------------+---------+---------+ +|root.ln.wf01.wt01| root.ln| false| t1| +|root.ln.wf02.wt02| root.ln| false| null| ++-----------------+-------------+---------+---------+ Total line number = 2 It costs 0.001s ``` @@ -235,14 +247,14 @@ IoTDB> count devices root.ln.** 你可以获得如下数据: ``` -+-------------------+---------+ -| devices|isAligned| -+-------------------+---------+ -|root.sgcc.wf03.wt03| false| -| root.turbine.d1| false| -| root.ln.wf02.wt02| false| -| root.ln.wf01.wt01| false| -+-------------------+---------+ ++-------------------+---------+---------+ +| devices|isAligned| Template| ++-------------------+---------+---------+ +|root.sgcc.wf03.wt03| false| null| +| root.turbine.d1| false| null| +| root.ln.wf02.wt02| false| null| +| root.ln.wf01.wt01| false| t1| ++-------------------+---------+---------+ Total line number = 4 It costs 0.024s diff --git a/src/zh/UserGuide/Master/stage/Operate-Metadata/Template.md b/src/zh/UserGuide/Master/stage/Operate-Metadata/Template.md index 1d52e1dc..8086a087 100644 --- a/src/zh/UserGuide/Master/stage/Operate-Metadata/Template.md +++ b/src/zh/UserGuide/Master/stage/Operate-Metadata/Template.md @@ -103,12 +103,12 @@ show devices root.sg1.** ``` ```shell -+---------------+---------+ -| devices|isAligned| -+---------------+---------+ -| root.sg1.d1| false| -| root.sg1.d2| true| -+---------------+---------+ ++---------------+---------+---------+ +| devices|isAligned| Template| ++---------------+---------+---------+ +| root.sg1.d1| false| null| +| root.sg1.d2| true| null| ++---------------+---------+---------+ ``` ## 查看元数据模板 From ff31b369419e5bf49ebf1dc934de8c2136c9d4a6 Mon Sep 17 00:00:00 2001 From: Linxt20 Date: Thu, 14 Dec 2023 13:05:03 +0800 Subject: [PATCH 2/3] add_and_change_show_devices_Template_column_EN --- src/UserGuide/Master/API/RestServiceV1.md | 14 ++- src/UserGuide/Master/API/RestServiceV2.md | 14 ++- src/UserGuide/Master/SQL-Manual/SQL-Manual.md | 2 + .../Master/User-Manual/Operate-Metadata.md | 96 ++++++++++--------- .../Master/stage/Operate-Metadata/Node.md | 84 +++++++++------- .../Master/stage/Operate-Metadata/Template.md | 12 +-- .../Master/User-Manual/Operate-Metadata.md | 1 + 7 files changed, 133 insertions(+), 90 deletions(-) diff --git a/src/UserGuide/Master/API/RestServiceV1.md b/src/UserGuide/Master/API/RestServiceV1.md index 2048c3c3..5dc7f1b8 100644 --- a/src/UserGuide/Master/API/RestServiceV1.md +++ b/src/UserGuide/Master/API/RestServiceV1.md @@ -523,7 +523,8 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X "expressions": null, "columnNames": [ "devices", - "isAligned" + "isAligned", + "Template" ], "timestamps": null, "values": [ @@ -534,6 +535,10 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X [ "false", "false" + ], + [ + "t1", + "null" ] ] } @@ -551,7 +556,8 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X "columnNames": [ "devices", "database", - "isAligned" + "isAligned", + "Template" ], "timestamps": null, "values": [ @@ -566,6 +572,10 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X [ "false", "false" + ], + [ + "t1", + "null" ] ] } diff --git a/src/UserGuide/Master/API/RestServiceV2.md b/src/UserGuide/Master/API/RestServiceV2.md index 900dfe5c..6cd9a902 100644 --- a/src/UserGuide/Master/API/RestServiceV2.md +++ b/src/UserGuide/Master/API/RestServiceV2.md @@ -523,7 +523,8 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X "expressions": null, "column_names": [ "devices", - "isAligned" + "isAligned", + "Template" ], "timestamps": null, "values": [ @@ -534,6 +535,10 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X [ "false", "false" + ], + [ + "t1", + "null" ] ] } @@ -551,7 +556,8 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X "column_names": [ "devices", "database", - "isAligned" + "isAligned", + "Template" ], "timestamps": null, "values": [ @@ -566,6 +572,10 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X [ "false", "false" + ], + [ + "t1", + "null" ] ] } diff --git a/src/UserGuide/Master/SQL-Manual/SQL-Manual.md b/src/UserGuide/Master/SQL-Manual/SQL-Manual.md index 9e1fc2f5..65b49f98 100644 --- a/src/UserGuide/Master/SQL-Manual/SQL-Manual.md +++ b/src/UserGuide/Master/SQL-Manual/SQL-Manual.md @@ -160,6 +160,8 @@ IoTDB> show schema templates IoTDB> show nodes in schema template t1 IoTDB> show paths set schema template t1 IoTDB> show paths using schema template t1 +IoTDB> show devices where template = t1 +IoTDB> show devices where template != t1 ``` ### Deactivate Schema Template diff --git a/src/UserGuide/Master/User-Manual/Operate-Metadata.md b/src/UserGuide/Master/User-Manual/Operate-Metadata.md index 7f10fe77..9f636276 100644 --- a/src/UserGuide/Master/User-Manual/Operate-Metadata.md +++ b/src/UserGuide/Master/User-Manual/Operate-Metadata.md @@ -397,12 +397,12 @@ show devices root.sg1.** ```` ```shell -+---------------+---------+ -| devices|isAligned| -+---------------+---------+ -| root.sg1.d1| false| -| root.sg1.d2| true| -+---------------+---------+ ++---------------+---------+---------+ +| devices|isAligned| Template| ++---------------+---------+---------+ +| root.sg1.d1| false| null| +| root.sg1.d2| true| null| ++---------------+---------+---------+ ```` ### Show Schema Template @@ -1092,6 +1092,7 @@ Similar to `Show Timeseries`, IoTDB also supports two ways of viewing devices: * `SHOW DEVICES` statement presents all devices' information, which is equal to `SHOW DEVICES root.**`. * `SHOW DEVICES ` statement specifies the `PathPattern` and returns the devices information matching the pathPattern and under the given level. * `WHERE` condition supports `DEVICE contains 'xxx'` to do a fuzzy query based on the device name. +* `WHERE` condition supports `TEMPLATE = 'xxx'`,`TEMPLATE != 'xxx` to do a filter query based on the template name. SQL statement is as follows: @@ -1099,33 +1100,42 @@ SQL statement is as follows: IoTDB> show devices IoTDB> show devices root.ln.** IoTDB> show devices root.ln.** where device contains 't' +IoTDB> show devices root.ln.** where template = "t1" ``` You can get results below: ``` -+-------------------+---------+ -| devices|isAligned| -+-------------------+---------+ -| root.ln.wf01.wt01| false| -| root.ln.wf02.wt02| false| -|root.sgcc.wf03.wt01| false| -| root.turbine.d1| false| -+-------------------+---------+ ++-------------------+---------+---------+ +| devices|isAligned| Template| ++-------------------+---------+---------+ +| root.ln.wf01.wt01| false| t1| +| root.ln.wf02.wt02| false| null| +|root.sgcc.wf03.wt01| false| null| +| root.turbine.d1| false| null| ++-------------------+---------+---------+ Total line number = 4 It costs 0.002s -+-----------------+---------+ -| devices|isAligned| -+-----------------+---------+ -|root.ln.wf01.wt01| false| -|root.ln.wf02.wt02| false| -+-----------------+---------+ ++-----------------+---------+---------+ +| devices|isAligned| Template| ++-----------------+---------+---------+ +|root.ln.wf01.wt01| false| t1| +|root.ln.wf02.wt02| false| null| ++-----------------+---------+---------+ Total line number = 2 It costs 0.001s + ++-----------------+---------+---------+ +| devices|isAligned| Template| ++-----------------+---------+---------+ +|root.ln.wf01.wt01| false| t1| ++-----------------+---------+---------+ +Total line number = 1 +It costs 0.001s ``` -`isAligned` indicates whether the timeseries under the device are aligned. +`isAligned` indicates whether the timeseries under the device are aligned, `Template` displays the name of the template activated on the device, with "null" indicating that no template has been activated. To view devices' information with database, we can use `SHOW DEVICES WITH DATABASE` statement. @@ -1143,23 +1153,23 @@ IoTDB> show devices root.ln.** with database You can get results below: ``` -+-------------------+-------------+---------+ -| devices| database|isAligned| -+-------------------+-------------+---------+ -| root.ln.wf01.wt01| root.ln| false| -| root.ln.wf02.wt02| root.ln| false| -|root.sgcc.wf03.wt01| root.sgcc| false| -| root.turbine.d1| root.turbine| false| -+-------------------+-------------+---------+ ++-------------------+-------------+---------+---------+ +| devices| database|isAligned| Template| ++-------------------+-------------+---------+---------+ +| root.ln.wf01.wt01| root.ln| false| t1| +| root.ln.wf02.wt02| root.ln| false| null| +|root.sgcc.wf03.wt01| root.sgcc| false| null| +| root.turbine.d1| root.turbine| false| null| ++-------------------+-------------+---------+---------+ Total line number = 4 It costs 0.003s -+-----------------+-------------+---------+ -| devices| database|isAligned| -+-----------------+-------------+---------+ -|root.ln.wf01.wt01| root.ln| false| -|root.ln.wf02.wt02| root.ln| false| -+-----------------+-------------+---------+ ++-----------------+-------------+---------+---------+ +| devices| database|isAligned| Template| ++-----------------+-------------+---------+---------+ +|root.ln.wf01.wt01| root.ln| false| t1| +|root.ln.wf02.wt02| root.ln| false| null| ++-----------------+-------------+---------+---------+ Total line number = 2 It costs 0.001s ``` @@ -1181,14 +1191,14 @@ IoTDB> count devices root.ln.** You can get results below: ``` -+-------------------+---------+ -| devices|isAligned| -+-------------------+---------+ -|root.sgcc.wf03.wt03| false| -| root.turbine.d1| false| -| root.ln.wf02.wt02| false| -| root.ln.wf01.wt01| false| -+-------------------+---------+ ++-------------------+---------+---------+ +| devices|isAligned| Template| ++-------------------+---------+---------+ +|root.sgcc.wf03.wt03| false| null| +| root.turbine.d1| false| null| +| root.ln.wf02.wt02| false| null| +| root.ln.wf01.wt01| false| t1| ++-------------------+---------+---------+ Total line number = 4 It costs 0.024s diff --git a/src/UserGuide/Master/stage/Operate-Metadata/Node.md b/src/UserGuide/Master/stage/Operate-Metadata/Node.md index 5747061b..9c9c82eb 100644 --- a/src/UserGuide/Master/stage/Operate-Metadata/Node.md +++ b/src/UserGuide/Master/stage/Operate-Metadata/Node.md @@ -141,6 +141,7 @@ Similar to `Show Timeseries`, IoTDB also supports two ways of viewing devices: * `SHOW DEVICES` statement presents all devices' information, which is equal to `SHOW DEVICES root.**`. * `SHOW DEVICES ` statement specifies the `PathPattern` and returns the devices information matching the pathPattern and under the given level. * `WHERE` condition supports `DEVICE contains 'xxx'` to do a fuzzy query based on the device name. +* `WHERE` condition supports `TEMPLATE = 'xxx'`,`TEMPLATE != 'xxx` to do a filter query based on the template name. SQL statement is as follows: @@ -148,33 +149,42 @@ SQL statement is as follows: IoTDB> show devices IoTDB> show devices root.ln.** IoTDB> show devices root.ln.** where device contains 't' +IoTDB> show devices root.ln.** where template = "t1" ``` You can get results below: ``` -+-------------------+---------+ -| devices|isAligned| -+-------------------+---------+ -| root.ln.wf01.wt01| false| -| root.ln.wf02.wt02| false| -|root.sgcc.wf03.wt01| false| -| root.turbine.d1| false| -+-------------------+---------+ ++-------------------+---------+---------+ +| devices|isAligned| Template| ++-------------------+---------+---------+ +| root.ln.wf01.wt01| false| t1| +| root.ln.wf02.wt02| false| null| +|root.sgcc.wf03.wt01| false| null| +| root.turbine.d1| false| null| ++-------------------+---------+---------+ Total line number = 4 It costs 0.002s -+-----------------+---------+ -| devices|isAligned| -+-----------------+---------+ -|root.ln.wf01.wt01| false| -|root.ln.wf02.wt02| false| -+-----------------+---------+ ++-----------------+---------+---------+ +| devices|isAligned| Template| ++-----------------+---------+---------+ +|root.ln.wf01.wt01| false| t1| +|root.ln.wf02.wt02| false| null| ++-----------------+---------+---------+ Total line number = 2 It costs 0.001s + ++-----------------+---------+---------+ +| devices|isAligned| Template| ++-----------------+---------+---------+ +|root.ln.wf01.wt01| false| t1| ++-----------------+---------+---------+ +Total line number = 1 +It costs 0.001s ``` -`isAligned` indicates whether the timeseries under the device are aligned. +`isAligned` indicates whether the timeseries under the device are aligned, `Template` displays the name of the template activated on the device, with "null" indicating that no template has been activated. To view devices' information with database, we can use `SHOW DEVICES WITH DATABASE` statement. @@ -192,23 +202,23 @@ IoTDB> show devices root.ln.** with database You can get results below: ``` -+-------------------+-------------+---------+ -| devices| database|isAligned| -+-------------------+-------------+---------+ -| root.ln.wf01.wt01| root.ln| false| -| root.ln.wf02.wt02| root.ln| false| -|root.sgcc.wf03.wt01| root.sgcc| false| -| root.turbine.d1| root.turbine| false| -+-------------------+-------------+---------+ ++-------------------+-------------+---------+---------+ +| devices| database|isAligned| Template| ++-------------------+-------------+---------+---------+ +| root.ln.wf01.wt01| root.ln| false| t1| +| root.ln.wf02.wt02| root.ln| false| null| +|root.sgcc.wf03.wt01| root.sgcc| false| null| +| root.turbine.d1| root.turbine| false| null| ++-------------------+-------------+---------+---------+ Total line number = 4 It costs 0.003s -+-----------------+-------------+---------+ -| devices| database|isAligned| -+-----------------+-------------+---------+ -|root.ln.wf01.wt01| root.ln| false| -|root.ln.wf02.wt02| root.ln| false| -+-----------------+-------------+---------+ ++-----------------+-------------+---------+---------+ +| devices| database|isAligned| Template| ++-----------------+-------------+---------+---------+ +|root.ln.wf01.wt01| root.ln| false| t1| +|root.ln.wf02.wt02| root.ln| false| null| ++-----------------+-------------+---------+---------+ Total line number = 2 It costs 0.001s ``` @@ -230,14 +240,14 @@ IoTDB> count devices root.ln.** You can get results below: ``` -+-------------------+---------+ -| devices|isAligned| -+-------------------+---------+ -|root.sgcc.wf03.wt03| false| -| root.turbine.d1| false| -| root.ln.wf02.wt02| false| -| root.ln.wf01.wt01| false| -+-------------------+---------+ ++-------------------+---------+---------+ +| devices|isAligned| Template| ++-------------------+---------+---------+ +|root.sgcc.wf03.wt03| false| null| +| root.turbine.d1| false| null| +| root.ln.wf02.wt02| false| null| +| root.ln.wf01.wt01| false| t1| ++-------------------+---------+---------+ Total line number = 4 It costs 0.024s diff --git a/src/UserGuide/Master/stage/Operate-Metadata/Template.md b/src/UserGuide/Master/stage/Operate-Metadata/Template.md index 25768b4c..e229d06e 100644 --- a/src/UserGuide/Master/stage/Operate-Metadata/Template.md +++ b/src/UserGuide/Master/stage/Operate-Metadata/Template.md @@ -104,12 +104,12 @@ show devices root.sg1.** ```` ```shell -+---------------+---------+ -| devices|isAligned| -+---------------+---------+ -| root.sg1.d1| false| -| root.sg1.d2| true| -+---------------+---------+ ++---------------+---------+---------+ +| devices|isAligned| Template| ++---------------+---------+---------+ +| root.sg1.d1| false| null| +| root.sg1.d2| true| null| ++---------------+---------+---------+ ```` ## Show Schema Template diff --git a/src/zh/UserGuide/Master/User-Manual/Operate-Metadata.md b/src/zh/UserGuide/Master/User-Manual/Operate-Metadata.md index 6c8e97dd..08c3e955 100644 --- a/src/zh/UserGuide/Master/User-Manual/Operate-Metadata.md +++ b/src/zh/UserGuide/Master/User-Manual/Operate-Metadata.md @@ -1065,6 +1065,7 @@ It costs 0.002s * `SHOW DEVICES` 语句显示当前所有的设备信息,等价于 `SHOW DEVICES root.**`。 * `SHOW DEVICES ` 语句规定了 `PathPattern`,返回给定的路径模式所匹配的设备信息。 * `WHERE` 条件中可以使用 `DEVICE contains 'xxx'`,根据 device 名称进行模糊查询。 +* `WHERE` 条件中可以使用 `TEMPLATE = 'xxx'`,`TEMPLATE != 'xxx'`,根据 template 名称进行过滤查询。 SQL 语句如下所示: From 7c83b77a97c8b9f913d5c7b6f87e507459503c43 Mon Sep 17 00:00:00 2001 From: Linxt20 Date: Sun, 24 Dec 2023 12:05:13 +0800 Subject: [PATCH 3/3] add_where_template_is_(not)_null --- src/UserGuide/Master/API/RestServiceV1.md | 4 +-- src/UserGuide/Master/API/RestServiceV2.md | 4 +-- src/UserGuide/Master/SQL-Manual/SQL-Manual.md | 6 +++-- .../Master/User-Manual/Operate-Metadata.md | 25 ++++++++++++++++--- .../Master/stage/Operate-Metadata/Node.md | 23 +++++++++++++++-- src/zh/UserGuide/Master/API/RestServiceV1.md | 4 +-- src/zh/UserGuide/Master/API/RestServiceV2.md | 4 +-- .../UserGuide/Master/SQL-Manual/SQL-Manual.md | 16 +++++++++--- .../Master/User-Manual/Operate-Metadata.md | 21 +++++++++++++++- .../Master/stage/Operate-Metadata/Node.md | 22 ++++++++++++++-- 10 files changed, 108 insertions(+), 21 deletions(-) diff --git a/src/UserGuide/Master/API/RestServiceV1.md b/src/UserGuide/Master/API/RestServiceV1.md index 5dc7f1b8..34af0567 100644 --- a/src/UserGuide/Master/API/RestServiceV1.md +++ b/src/UserGuide/Master/API/RestServiceV1.md @@ -538,7 +538,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ], [ "t1", - "null" + null ] ] } @@ -575,7 +575,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ], [ "t1", - "null" + null ] ] } diff --git a/src/UserGuide/Master/API/RestServiceV2.md b/src/UserGuide/Master/API/RestServiceV2.md index 6cd9a902..24fe76b6 100644 --- a/src/UserGuide/Master/API/RestServiceV2.md +++ b/src/UserGuide/Master/API/RestServiceV2.md @@ -538,7 +538,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ], [ "t1", - "null" + null ] ] } @@ -575,7 +575,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ], [ "t1", - "null" + null ] ] } diff --git a/src/UserGuide/Master/SQL-Manual/SQL-Manual.md b/src/UserGuide/Master/SQL-Manual/SQL-Manual.md index 65b49f98..4439e23b 100644 --- a/src/UserGuide/Master/SQL-Manual/SQL-Manual.md +++ b/src/UserGuide/Master/SQL-Manual/SQL-Manual.md @@ -160,8 +160,10 @@ IoTDB> show schema templates IoTDB> show nodes in schema template t1 IoTDB> show paths set schema template t1 IoTDB> show paths using schema template t1 -IoTDB> show devices where template = t1 -IoTDB> show devices where template != t1 +IoTDB> show devices where template = 't1' +IoTDB> show devices where template != 't1' +IoTDB> show devices where template is null +IoTDB> show devices where template is not null ``` ### Deactivate Schema Template diff --git a/src/UserGuide/Master/User-Manual/Operate-Metadata.md b/src/UserGuide/Master/User-Manual/Operate-Metadata.md index 9f636276..77b9f00f 100644 --- a/src/UserGuide/Master/User-Manual/Operate-Metadata.md +++ b/src/UserGuide/Master/User-Manual/Operate-Metadata.md @@ -1092,7 +1092,8 @@ Similar to `Show Timeseries`, IoTDB also supports two ways of viewing devices: * `SHOW DEVICES` statement presents all devices' information, which is equal to `SHOW DEVICES root.**`. * `SHOW DEVICES ` statement specifies the `PathPattern` and returns the devices information matching the pathPattern and under the given level. * `WHERE` condition supports `DEVICE contains 'xxx'` to do a fuzzy query based on the device name. -* `WHERE` condition supports `TEMPLATE = 'xxx'`,`TEMPLATE != 'xxx` to do a filter query based on the template name. +* `WHERE` condition supports `TEMPLATE = 'xxx'`,`TEMPLATE != 'xxx'` to do a filter query based on the template name. +* `WHERE` condition supports `TEMPLATE is null`,`TEMPLATE is not null` to do a filter query based on whether the template is null (null indicating it's inactive) SQL statement is as follows: @@ -1100,7 +1101,8 @@ SQL statement is as follows: IoTDB> show devices IoTDB> show devices root.ln.** IoTDB> show devices root.ln.** where device contains 't' -IoTDB> show devices root.ln.** where template = "t1" +IoTDB> show devices root.ln.** where template = 't1' +IoTDB> show devices root.ln.** where template is null ``` You can get results below: @@ -1130,12 +1132,29 @@ It costs 0.001s | devices|isAligned| Template| +-----------------+---------+---------+ |root.ln.wf01.wt01| false| t1| +|root.ln.wf02.wt02| false| null| ++-----------------+---------+---------+ +Total line number = 2 +It costs 0.001s + ++-----------------+---------+---------+ +| devices|isAligned| Template| ++-----------------+---------+---------+ +|root.ln.wf01.wt01| false| t1| ++-----------------+---------+---------+ +Total line number = 1 +It costs 0.001s + ++-----------------+---------+---------+ +| devices|isAligned| Template| ++-----------------+---------+---------+ +|root.ln.wf02.wt02| false| null| +-----------------+---------+---------+ Total line number = 1 It costs 0.001s ``` -`isAligned` indicates whether the timeseries under the device are aligned, `Template` displays the name of the template activated on the device, with "null" indicating that no template has been activated. +`isAligned` indicates whether the timeseries under the device are aligned, `Template` displays the name of the template activated on the device, with `null` indicating that no template has been activated. To view devices' information with database, we can use `SHOW DEVICES WITH DATABASE` statement. diff --git a/src/UserGuide/Master/stage/Operate-Metadata/Node.md b/src/UserGuide/Master/stage/Operate-Metadata/Node.md index 9c9c82eb..b8860965 100644 --- a/src/UserGuide/Master/stage/Operate-Metadata/Node.md +++ b/src/UserGuide/Master/stage/Operate-Metadata/Node.md @@ -141,7 +141,8 @@ Similar to `Show Timeseries`, IoTDB also supports two ways of viewing devices: * `SHOW DEVICES` statement presents all devices' information, which is equal to `SHOW DEVICES root.**`. * `SHOW DEVICES ` statement specifies the `PathPattern` and returns the devices information matching the pathPattern and under the given level. * `WHERE` condition supports `DEVICE contains 'xxx'` to do a fuzzy query based on the device name. -* `WHERE` condition supports `TEMPLATE = 'xxx'`,`TEMPLATE != 'xxx` to do a filter query based on the template name. +* `WHERE` condition supports `TEMPLATE = 'xxx'`,`TEMPLATE != 'xxx'` to do a filter query based on the template name. +* `WHERE` condition supports `TEMPLATE is null`,`TEMPLATE is not null` to do a filter query based on whether the template is null (indicating it's inactive) or not null (indicating activation). SQL statement is as follows: @@ -149,7 +150,8 @@ SQL statement is as follows: IoTDB> show devices IoTDB> show devices root.ln.** IoTDB> show devices root.ln.** where device contains 't' -IoTDB> show devices root.ln.** where template = "t1" +IoTDB> show devices root.ln.** where template = 't1' +IoTDB> show devices root.ln.** where template is null ``` You can get results below: @@ -179,6 +181,23 @@ It costs 0.001s | devices|isAligned| Template| +-----------------+---------+---------+ |root.ln.wf01.wt01| false| t1| +|root.ln.wf02.wt02| false| null| ++-----------------+---------+---------+ +Total line number = 2 +It costs 0.001s + ++-----------------+---------+---------+ +| devices|isAligned| Template| ++-----------------+---------+---------+ +|root.ln.wf01.wt01| false| t1| ++-----------------+---------+---------+ +Total line number = 1 +It costs 0.001s + ++-----------------+---------+---------+ +| devices|isAligned| Template| ++-----------------+---------+---------+ +|root.ln.wf02.wt02| false| null| +-----------------+---------+---------+ Total line number = 1 It costs 0.001s diff --git a/src/zh/UserGuide/Master/API/RestServiceV1.md b/src/zh/UserGuide/Master/API/RestServiceV1.md index b58a71ec..b7243662 100644 --- a/src/zh/UserGuide/Master/API/RestServiceV1.md +++ b/src/zh/UserGuide/Master/API/RestServiceV1.md @@ -543,7 +543,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ], [ "t1", - "null" + null ] ] } @@ -581,7 +581,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ], [ "t1", - "null" + null ] ] } diff --git a/src/zh/UserGuide/Master/API/RestServiceV2.md b/src/zh/UserGuide/Master/API/RestServiceV2.md index 37c3c3a5..e174fee3 100644 --- a/src/zh/UserGuide/Master/API/RestServiceV2.md +++ b/src/zh/UserGuide/Master/API/RestServiceV2.md @@ -543,7 +543,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ], [ "t1", - "null" + null ] ] } @@ -581,7 +581,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ], [ "t1", - "null" + null ] ] } diff --git a/src/zh/UserGuide/Master/SQL-Manual/SQL-Manual.md b/src/zh/UserGuide/Master/SQL-Manual/SQL-Manual.md index 2d35bf74..32dc1bf9 100644 --- a/src/zh/UserGuide/Master/SQL-Manual/SQL-Manual.md +++ b/src/zh/UserGuide/Master/SQL-Manual/SQL-Manual.md @@ -306,11 +306,21 @@ IoTDB> show paths using schema template t1 IoTDB> show devices using schema template t1 -IoTDB> show devices where template = t1 +- 查看使用了某个元数据模板的设备信息 -- 查看没有使用指定元数据模板的路径 +IoTDB> show devices where template = 't1' -IoTDB> show devices where template != t1 +- 查看没有使用某个元数据模板的设备信息 + +IoTDB> show devices where template != 't1' + +- 查看没有使用元数据模板的设备信息 + +IoTDB> show devices where template is null + +- 查看使用元数据模板的设备信息 + +IoTDB> show devices where template is not null #### 解除元数据模板 diff --git a/src/zh/UserGuide/Master/User-Manual/Operate-Metadata.md b/src/zh/UserGuide/Master/User-Manual/Operate-Metadata.md index 08c3e955..3780ae69 100644 --- a/src/zh/UserGuide/Master/User-Manual/Operate-Metadata.md +++ b/src/zh/UserGuide/Master/User-Manual/Operate-Metadata.md @@ -1066,6 +1066,7 @@ It costs 0.002s * `SHOW DEVICES ` 语句规定了 `PathPattern`,返回给定的路径模式所匹配的设备信息。 * `WHERE` 条件中可以使用 `DEVICE contains 'xxx'`,根据 device 名称进行模糊查询。 * `WHERE` 条件中可以使用 `TEMPLATE = 'xxx'`,`TEMPLATE != 'xxx'`,根据 template 名称进行过滤查询。 +* `WHERE` 条件中可以使用 `TEMPLATE is null`,`TEMPLATE is not null`,根据 template 是否为null(null 表示没激活)进行过滤查询。 SQL 语句如下所示: @@ -1073,7 +1074,8 @@ SQL 语句如下所示: IoTDB> show devices IoTDB> show devices root.ln.** IoTDB> show devices root.ln.** where device contains 't' -IoTDB> show devices root.ln.** where template = "t1" +IoTDB> show devices root.ln.** where template = 't1' +IoTDB> show devices root.ln.** where template is null ``` 你可以获得如下数据: @@ -1103,6 +1105,23 @@ It costs 0.001s | devices|isAligned| Template| +-----------------+---------+---------+ |root.ln.wf01.wt01| false| t1| +|root.ln.wf02.wt02| false| null| ++-----------------+---------+---------+ +Total line number = 2 +It costs 0.001s + ++-----------------+---------+---------+ +| devices|isAligned| Template| ++-----------------+---------+---------+ +|root.ln.wf01.wt01| false| t1| ++-----------------+---------+---------+ +Total line number = 1 +It costs 0.001s + ++-----------------+---------+---------+ +| devices|isAligned| Template| ++-----------------+---------+---------+ +|root.ln.wf02.wt02| false| null| +-----------------+---------+---------+ Total line number = 1 It costs 0.001s diff --git a/src/zh/UserGuide/Master/stage/Operate-Metadata/Node.md b/src/zh/UserGuide/Master/stage/Operate-Metadata/Node.md index 7ee140b4..fe461820 100644 --- a/src/zh/UserGuide/Master/stage/Operate-Metadata/Node.md +++ b/src/zh/UserGuide/Master/stage/Operate-Metadata/Node.md @@ -148,7 +148,7 @@ It costs 0.002s * `SHOW DEVICES ` 语句规定了 `PathPattern`,返回给定的路径模式所匹配的设备信息。 * `WHERE` 条件中可以使用 `DEVICE contains 'xxx'`,根据 device 名称进行模糊查询。 * `WHERE` 条件中可以使用 `TEMPLATE = 'xxx'`,`TEMPLATE != 'xxx'`,根据 template 名称进行过滤查询。 - +* `WHERE` 条件中可以使用 `TEMPLATE is null`,`TEMPLATE is not null`,根据 template 是否为null(null 表示没激活)进行过滤查询。 SQL 语句如下所示: @@ -156,7 +156,8 @@ SQL 语句如下所示: IoTDB> show devices IoTDB> show devices root.ln.** IoTDB> show devices root.ln.** where device contains 't' -IoTDB> show devices root.ln.** where template = "t1" +IoTDB> show devices root.ln.** where template = 't1' +IoTDB> show devices root.ln.** where template is null ``` 你可以获得如下数据: @@ -186,6 +187,23 @@ It costs 0.001s | devices|isAligned| Template| +-----------------+---------+---------+ |root.ln.wf01.wt01| false| t1| +|root.ln.wf02.wt02| false| null| ++-----------------+---------+---------+ +Total line number = 2 +It costs 0.001s + ++-----------------+---------+---------+ +| devices|isAligned| Template| ++-----------------+---------+---------+ +|root.ln.wf01.wt01| false| t1| ++-----------------+---------+---------+ +Total line number = 1 +It costs 0.001s + ++-----------------+---------+---------+ +| devices|isAligned| Template| ++-----------------+---------+---------+ +|root.ln.wf02.wt02| false| null| +-----------------+---------+---------+ Total line number = 1 It costs 0.001s