Skip to content

Commit 1953433

Browse files
committed
[文档] 树模型 SHOW TIMESERIES 支持按测点名排序(V2.0.11)
- 更新 SHOW TIMESERIES 语法定义(新增 orderByTimeseriesClause) - 新增 ORDER BY TIMESERIES (ASC | DESC) 排序用法及示例(V2.0.11 起) - 新增 SHOW INVALID TIMESERIES 说明(V2.0.8 起) - 使用介绍条目统一为加粗 + 行内代码格式
1 parent e2d1abd commit 1953433

4 files changed

Lines changed: 274 additions & 100 deletions

File tree

src/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_apache.md

Lines changed: 69 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -666,21 +666,28 @@ drop timeseries root.ln.wf02.*;
666666

667667
### 3.4 Show Timeseries
668668

669-
* SHOW LATEST? TIMESERIES pathPattern? whereClause? limitClause?
669+
#### 1. Grammar
670670

671-
There are four optional clauses added in SHOW TIMESERIES, return information of time series
672-
673-
Timeseries information includes: timeseries path, alias of measurement, database it belongs to, data type, encoding type, compression type, tags and attributes.
671+
```sql
672+
// ---- Show Timeseries
673+
showTimeseries
674+
: SHOW LATEST? TIMESERIES prefixPath? timeseriesWhereClause? timeConditionClause? orderByTimeseriesClause? rowPaginationClause?
675+
;
676+
// order by timeseries for SHOW TIMESERIES
677+
orderByTimeseriesClause
678+
: ORDER BY TIMESERIES (ASC | DESC)?
679+
;
680+
```
674681

675-
Examples:
682+
The timeseries query results include: timeseries path, database, alias of measurement, data type, encoding, compression, tags and attributes, etc.
676683

677-
* SHOW TIMESERIES
684+
> Note: Since V2.0.11, the query results can be sorted by timeseries name.
678685

679-
presents all timeseries information in JSON form
686+
#### 2. Usage
680687

681-
* SHOW TIMESERIES <`PathPattern`>
688+
* **`SHOW TIMESERIES`**: presents all timeseries information in the system
682689

683-
returns all timeseries information matching the given <`PathPattern`>. SQL statements are as follows:
690+
* **`SHOW TIMESERIES <Path>`**: returns all timeseries information under the given path. The `Path` should be a timeseries path or a path pattern. For example, to view the timeseries under the `root` path and the `root.ln` path respectively, the SQL statements are as follows:
684691

685692
```sql
686693
show timeseries root.**;
@@ -716,17 +723,13 @@ Total line number = 4
716723
It costs 0.004s
717724
```
718725
719-
* SHOW TIMESERIES LIMIT INT OFFSET INT
720-
721-
returns all the timeseries information start from the offset and limit the number of series returned. For example,
726+
* **`SHOW TIMESERIES LIMIT INT OFFSET INT`**: returns all the timeseries information start from the offset and limit the number of series returned. For example,
722727
723728
```sql
724729
show timeseries root.ln.** limit 10 offset 10
725730
```
726731

727-
* SHOW TIMESERIES WHERE TIMESERIES contains 'containStr'
728-
729-
The query result set is filtered by string fuzzy matching based on the names of the timeseries. For example:
732+
* **`SHOW TIMESERIES WHERE TIMESERIES contains 'containStr'`**: The query result set is filtered by string fuzzy matching based on the names of the timeseries. For example:
730733

731734
```sql
732735
show timeseries root.ln.** where timeseries contains 'wf01.wt'
@@ -745,9 +748,7 @@ Total line number = 2
745748
It costs 0.016s
746749
```
747750

748-
* SHOW TIMESERIES WHERE DataType=type
749-
750-
The query result set is filtered by data type. For example:
751+
* **`SHOW TIMESERIES WHERE DataType=type`**: The query result set is filtered by data type. For example:
751752

752753
```sql
753754
show timeseries root.ln.** where dataType=FLOAT
@@ -768,10 +769,7 @@ It costs 0.016s
768769
769770
```
770771

771-
* SHOW TIMESERIES WHERE TAGS(KEY) = VALUE
772-
* SHOW TIMESERIES WHERE TAGS(KEY) CONTAINS VALUE
773-
774-
The query result set is filtered by tags. For example:
772+
* **`SHOW TIMESERIES WHERE TAGS(KEY) = VALUE`** / **`SHOW TIMESERIES WHERE TAGS(KEY) CONTAINS VALUE`**: The query result set is filtered by tags. For example:
775773

776774
```sql
777775
show timeseries root.ln.** where TAGS(unit)='c';
@@ -800,11 +798,57 @@ It costs 0.004s
800798
```
801799

802800

803-
* SHOW LATEST TIMESERIES
801+
* **`SHOW LATEST TIMESERIES`**: the returned timeseries are sorted in descending order of the last insertion timestamp. Note that when the queried path does not exist, the system will return 0 timeseries.
802+
803+
* **`SHOW INVALID TIMESERIES`**: Since V2.0.8, this SQL statement is supported to show the invalidated timeseries after a full path rename succeeds.
804+
805+
```sql
806+
show invalid timeSeries
807+
```
808+
809+
```
810+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
811+
| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| NewPath|
812+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
813+
|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE|root.newln.newwf.newwt.temperature|
814+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
815+
```
816+
817+
Note: The last column `NewPath` in the result shows the new timeseries corresponding to the invalidated one, which serves scenarios such as view construction and cluster migration (Load + rename).
818+
819+
* **`SHOW TIMESERIES ORDER BY TIMESERIES (ASC | DESC)`**: Since V2.0.11, the query results can be sorted by timeseries name.
820+
821+
```sql
822+
-- Sort by timeseries name in descending order
823+
show timeseries root.ln.** order by timeseries desc
824+
```
825+
826+
```
827+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
828+
| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType|
829+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
830+
| root.ln.wf02.wt02.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE|
831+
| root.ln.wf02.wt02.hardware| null| root.ln| TEXT| PLAIN| LZ4|null| null| null| null| BASE|
832+
|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE|
833+
| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE|
834+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
835+
```
804836

805-
all the returned timeseries information should be sorted in descending order of the last timestamp of timeseries
837+
```sql
838+
-- Sort by timeseries name in ascending order
839+
show timeseries root.ln.** order by timeseries asc
840+
```
806841

807-
It is worth noting that when the queried path does not exist, the system will return no timeseries.
842+
```
843+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
844+
| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType|
845+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
846+
| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE|
847+
|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE|
848+
| root.ln.wf02.wt02.hardware| null| root.ln| TEXT| PLAIN| LZ4|null| null| null| null| BASE|
849+
| root.ln.wf02.wt02.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE|
850+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
851+
```
808852

809853

810854
### 3.5 Count Timeseries

src/UserGuide/latest/Basic-Concept/Operate-Metadata_apache.md

Lines changed: 69 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -666,21 +666,28 @@ drop timeseries root.ln.wf02.*;
666666

667667
### 3.4 Show Timeseries
668668

669-
* SHOW LATEST? TIMESERIES pathPattern? whereClause? limitClause?
669+
#### 1. Grammar
670670

671-
There are four optional clauses added in SHOW TIMESERIES, return information of time series
672-
673-
Timeseries information includes: timeseries path, alias of measurement, database it belongs to, data type, encoding type, compression type, tags and attributes.
671+
```sql
672+
// ---- Show Timeseries
673+
showTimeseries
674+
: SHOW LATEST? TIMESERIES prefixPath? timeseriesWhereClause? timeConditionClause? orderByTimeseriesClause? rowPaginationClause?
675+
;
676+
// order by timeseries for SHOW TIMESERIES
677+
orderByTimeseriesClause
678+
: ORDER BY TIMESERIES (ASC | DESC)?
679+
;
680+
```
674681

675-
Examples:
682+
The timeseries query results include: timeseries path, database, alias of measurement, data type, encoding, compression, tags and attributes, etc.
676683

677-
* SHOW TIMESERIES
684+
> Note: Since V2.0.11, the query results can be sorted by timeseries name.
678685

679-
presents all timeseries information in JSON form
686+
#### 2. Usage
680687

681-
* SHOW TIMESERIES <`PathPattern`>
688+
* **`SHOW TIMESERIES`**: presents all timeseries information in the system
682689

683-
returns all timeseries information matching the given <`PathPattern`>. SQL statements are as follows:
690+
* **`SHOW TIMESERIES <Path>`**: returns all timeseries information under the given path. The `Path` should be a timeseries path or a path pattern. For example, to view the timeseries under the `root` path and the `root.ln` path respectively, the SQL statements are as follows:
684691

685692
```sql
686693
show timeseries root.**;
@@ -716,17 +723,13 @@ Total line number = 4
716723
It costs 0.004s
717724
```
718725
719-
* SHOW TIMESERIES LIMIT INT OFFSET INT
720-
721-
returns all the timeseries information start from the offset and limit the number of series returned. For example,
726+
* **`SHOW TIMESERIES LIMIT INT OFFSET INT`**: returns all the timeseries information start from the offset and limit the number of series returned. For example,
722727
723728
```sql
724729
show timeseries root.ln.** limit 10 offset 10
725730
```
726731

727-
* SHOW TIMESERIES WHERE TIMESERIES contains 'containStr'
728-
729-
The query result set is filtered by string fuzzy matching based on the names of the timeseries. For example:
732+
* **`SHOW TIMESERIES WHERE TIMESERIES contains 'containStr'`**: The query result set is filtered by string fuzzy matching based on the names of the timeseries. For example:
730733

731734
```sql
732735
show timeseries root.ln.** where timeseries contains 'wf01.wt'
@@ -745,9 +748,7 @@ Total line number = 2
745748
It costs 0.016s
746749
```
747750

748-
* SHOW TIMESERIES WHERE DataType=type
749-
750-
The query result set is filtered by data type. For example:
751+
* **`SHOW TIMESERIES WHERE DataType=type`**: The query result set is filtered by data type. For example:
751752

752753
```sql
753754
show timeseries root.ln.** where dataType=FLOAT
@@ -768,10 +769,7 @@ It costs 0.016s
768769
769770
```
770771

771-
* SHOW TIMESERIES WHERE TAGS(KEY) = VALUE
772-
* SHOW TIMESERIES WHERE TAGS(KEY) CONTAINS VALUE
773-
774-
The query result set is filtered by tags. For example:
772+
* **`SHOW TIMESERIES WHERE TAGS(KEY) = VALUE`** / **`SHOW TIMESERIES WHERE TAGS(KEY) CONTAINS VALUE`**: The query result set is filtered by tags. For example:
775773

776774
```sql
777775
show timeseries root.ln.** where TAGS(unit)='c';
@@ -800,11 +798,57 @@ It costs 0.004s
800798
```
801799

802800

803-
* SHOW LATEST TIMESERIES
801+
* **`SHOW LATEST TIMESERIES`**: the returned timeseries are sorted in descending order of the last insertion timestamp. Note that when the queried path does not exist, the system will return 0 timeseries.
802+
803+
* **`SHOW INVALID TIMESERIES`**: Since V2.0.8, this SQL statement is supported to show the invalidated timeseries after a full path rename succeeds.
804+
805+
```sql
806+
show invalid timeSeries
807+
```
808+
809+
```
810+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
811+
| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| NewPath|
812+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
813+
|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE|root.newln.newwf.newwt.temperature|
814+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
815+
```
816+
817+
Note: The last column `NewPath` in the result shows the new timeseries corresponding to the invalidated one, which serves scenarios such as view construction and cluster migration (Load + rename).
818+
819+
* **`SHOW TIMESERIES ORDER BY TIMESERIES (ASC | DESC)`**: Since V2.0.11, the query results can be sorted by timeseries name.
820+
821+
```sql
822+
-- Sort by timeseries name in descending order
823+
show timeseries root.ln.** order by timeseries desc
824+
```
825+
826+
```
827+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
828+
| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType|
829+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
830+
| root.ln.wf02.wt02.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE|
831+
| root.ln.wf02.wt02.hardware| null| root.ln| TEXT| PLAIN| LZ4|null| null| null| null| BASE|
832+
|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE|
833+
| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE|
834+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
835+
```
804836

805-
all the returned timeseries information should be sorted in descending order of the last timestamp of timeseries
837+
```sql
838+
-- Sort by timeseries name in ascending order
839+
show timeseries root.ln.** order by timeseries asc
840+
```
806841

807-
It is worth noting that when the queried path does not exist, the system will return no timeseries.
842+
```
843+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
844+
| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType|
845+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
846+
| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE|
847+
|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE|
848+
| root.ln.wf02.wt02.hardware| null| root.ln| TEXT| PLAIN| LZ4|null| null| null| null| BASE|
849+
| root.ln.wf02.wt02.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE|
850+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
851+
```
808852

809853

810854
### 3.5 Count Timeseries

0 commit comments

Comments
 (0)