Skip to content

Commit 764b963

Browse files
authored
support modify timeseries name from 2082 (#1030)
1 parent f0fae08 commit 764b963

12 files changed

Lines changed: 240 additions & 44 deletions

File tree

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

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,32 @@ You can set different datatype, encoding, and compression for the timeseries in
421421

422422
It is also supported to set an alias, tag, and attribute for aligned timeseries.
423423

424-
### 2.3 Delete Timeseries
424+
### 2.3 Modifying Timeseries Name
425+
426+
Since version V2.0.8, it has been supported to modify the full path name of a timeseries through SQL statements. After a successful modification, the original name becomes invalid but is still retained in the metadata storage.
427+
428+
Syntax definition:
429+
430+
```sql
431+
-- Supports modifying the full path of a certain sequence to another full path
432+
ALTER TIMESERIES <oldPath> RENAME TO <newPath>
433+
```
434+
435+
Usage instructions:
436+
437+
- This statement takes effect immediately upon successful execution, and the tags/attributes/alias of the original sequence will be migrated to the new sequence.
438+
- The invalidated sequence (original sequence) no longer supports write, query, delete, or other operations. The name of the invalidated sequence will be retained by the system, and creating a new sequence with the same name is not allowed. This ensures the uniqueness and traceability of the original sequence name: it supports viewing the original sequence through the `SHOW INVALID TIMESERIES` statement, preventing the loss of original sequence information due to frequent modifications, significantly improving data traceability and problem localization efficiency.
439+
- The new sequence does not support creating views. When modifying the encoding, compression, sequence type, tags, attributes, or alias of the new sequence, the original sequence will not be modified; deleting the new sequence will also modify the original sequence.
440+
- If the new sequence path or the alias of the original sequence under the target device already exists (including real sequences, views, invalid sequences, and their aliases), the system will report an error.
441+
442+
Usage example:
443+
444+
```sql
445+
ALTER TIMESERIES root.ln.wf01.wt01.temperature RENAME TO root.newln.newwf.newwt.temperature
446+
```
447+
448+
449+
### 2.4 Delete Timeseries
425450

426451
To delete the timeseries we created before, we are able to use `(DELETE | DROP) TimeSeries <PathPattern>` statement.
427452

@@ -434,7 +459,7 @@ delete timeseries root.ln.wf02.*;
434459
drop timeseries root.ln.wf02.*;
435460
```
436461

437-
### 2.4 Show Timeseries
462+
### 2.5 Show Timeseries
438463

439464
* SHOW LATEST? TIMESERIES pathPattern? whereClause? limitClause?
440465

@@ -577,8 +602,23 @@ It costs 0.004s
577602

578603
It is worth noting that when the queried path does not exist, the system will return no timeseries.
579604

605+
- SHOW INVALID TIMESERIES
606+
607+
Since version V2.0.8, this SQL statement is supported to display the invalidated timeseries after a successful full path name modification.
608+
609+
```sql
610+
IoTDB> show invalid timeSeries
611+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
612+
| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| NewPath|
613+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
614+
|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE|root.newln.newwf.newwt.temperature|
615+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
616+
```
617+
618+
Explanation: The last column, "NewPath," in the returned result displays the new sequence corresponding to the invalidated sequence. This serves scenarios such as view construction and cluster migration (Load + rename).
619+
580620

581-
### 2.5 Count Timeseries
621+
### 2.6 Count Timeseries
582622

583623
IoTDB is able to use `COUNT TIMESERIES <Path>` to count the number of timeseries matching the path. SQL statements are as follows:
584624

@@ -663,7 +703,7 @@ It costs 0.002s
663703

664704
> Note: The path of timeseries is just a filter condition, which has no relationship with the definition of level.
665705
666-
### 2.6 Active Timeseries Query
706+
### 2.7 Active Timeseries Query
667707
By adding WHERE time filter conditions to the existing SHOW/COUNT TIMESERIES, we can obtain time series with data within the specified time range.
668708

669709
It is important to note that in metadata queries with time filters, views are not considered; only the time series actually stored in the TsFile are taken into account.
@@ -703,7 +743,7 @@ count timeseries where time >= 15000 and time < 16000;
703743
+-----------------+
704744
```
705745
Regarding the definition of active time series, data that can be queried normally is considered active, meaning time series that have been inserted but deleted are not included.
706-
### 2.7 Tag and Attribute Management
746+
### 2.8 Tag and Attribute Management
707747

708748
We can also add an alias, extra tag and attribute information while creating one timeseries.
709749

src/UserGuide/Master/Tree/SQL-Manual/SQL-Manual_timecho.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,15 @@ error: encoding TS_2DIFF does not support BOOLEAN
142142
CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(latitude FLOAT , longitude FLOAT);
143143
```
144144

145-
### 2.3 Delete Timeseries
145+
### 2.3 Modify Timeseries Name
146+
147+
> This statement is supported from V2.0.8 onwards
148+
149+
```sql
150+
ALTER TIMESERIES root.ln.wf01.wt01.temperature RENAME TO root.newln.newwf.newwt.temperature
151+
```
152+
153+
### 2.4 Delete Timeseries
146154

147155
```sql
148156
delete timeseries root.ln.wf01.wt01.status;
@@ -151,17 +159,20 @@ delete timeseries root.ln.wf02.*;
151159
drop timeseries root.ln.wf02.*;
152160
```
153161

154-
### 2.4 Show Timeseries
162+
### 2.5 Show Timeseries
155163

156164
```sql
157165
show timeseries root.**;
158166
show timeseries root.ln.**;
159167
show timeseries root.ln.** limit 10 offset 10;
160168
show timeseries root.ln.** where timeseries contains 'wf01.wt';
161169
show timeseries root.ln.** where dataType=FLOAT;
170+
show timeseries root.ln.** where time>=2017-01-01T00:00:00 and time<=2017-11-01T16:26:00;
171+
show latest timeseries;
172+
show invalid timeseries; -- This statement is supported from V2.0.8.2 onwards;
162173
```
163174

164-
### 2.5 Count Timeseries
175+
### 2.6 Count Timeseries
165176

166177
```sql
167178
COUNT TIMESERIES root.**;
@@ -178,7 +189,7 @@ COUNT TIMESERIES root.ln.** GROUP BY LEVEL=2;
178189
COUNT TIMESERIES root.ln.wf01.* GROUP BY LEVEL=2;
179190
```
180191

181-
### 2.6 Tag and Attribute Management
192+
### 2.7 Tag and Attribute Management
182193

183194
```sql
184195
create timeseries root.turbine.d1.s1(temprature) with datatype=FLOAT tags(tag1=v1, tag2=v2) attributes(attr1=v1, attr2=v2);

src/UserGuide/Master/Tree/User-Manual/Authority-Management_timecho.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ The table below describes the types and scope of these permissions:
7979

8080

8181

82-
| Permission Name | Description |
83-
|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
84-
| READ_DATA | Allows reading time series data under the authorized path. |
85-
| WRITE_DATA | Allows reading time series data under the authorized path.<br/>Allows inserting and deleting time series data under the authorized path.<br/>Allows importing and loading data under the authorized path. When importing data, you need the WRITE_DATA permission for the corresponding path. When automatically creating databases or time series, you need MANAGE_DATABASE and WRITE_SCHEMA permissions. |
86-
| READ_SCHEMA | Allows obtaining detailed information about the metadata tree under the authorized path, <br/>including databases, child paths, child nodes, devices, time series, templates, views, etc. |
87-
| WRITE_SCHEMA | Allows obtaining detailed information about the metadata tree under the authorized path.<br/>Allows creating, deleting, and modifying time series, templates, views, etc. under the authorized path. When creating or modifying views, it checks the WRITE_SCHEMA permission for the view path and READ_SCHEMA permission for the data source. When querying and inserting data into views, it checks the READ_DATA and WRITE_DATA permissions for the view path.<br/> Allows setting, unsetting, and viewing TTL under the authorized path. <br/> Allows attaching or detaching templates under the authorized path. |
82+
| Permission Name | Description |
83+
|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
84+
| READ_DATA | Allows reading time series data under the authorized path. |
85+
| WRITE_DATA | Allows reading time series data under the authorized path.<br/>Allows inserting and deleting time series data under the authorized path.<br/>Allows importing and loading data under the authorized path. When importing data, you need the WRITE_DATA permission for the corresponding path. When automatically creating databases or time series, you need MANAGE_DATABASE and WRITE_SCHEMA permissions. |
86+
| READ_SCHEMA | Allows obtaining detailed information about the metadata tree under the authorized path, <br/>including databases, child paths, child nodes, devices, time series, templates, views, etc. |
87+
| WRITE_SCHEMA | Allows obtaining detailed information about the metadata tree under the authorized path.<br/>Allows creating, deleting, and modifying time series, templates, views, etc. under the authorized path. When creating or modifying views, it checks the WRITE_SCHEMA permission for the view path and READ_SCHEMA permission for the data source. When querying and inserting data into views, it checks the READ_DATA and WRITE_DATA permissions for the view path.<br/> Allows setting, unsetting, and viewing TTL under the authorized path. <br/> Allows attaching or detaching templates under the authorized path.<br/> Allowed to modify the full path name of a timeseries under an authorized path. -- Supported from V2.0.8 onwards |
8888

8989

9090
### 3.2 Global Permissions

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

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,32 @@ You can set different datatype, encoding, and compression for the timeseries in
421421

422422
It is also supported to set an alias, tag, and attribute for aligned timeseries.
423423

424-
### 2.3 Delete Timeseries
424+
### 2.3 Modifying Timeseries Name
425+
426+
Since version V2.0.8, it has been supported to modify the full path name of a timeseries through SQL statements. After a successful modification, the original name becomes invalid but is still retained in the metadata storage.
427+
428+
Syntax definition:
429+
430+
```sql
431+
-- Supports modifying the full path of a certain sequence to another full path
432+
ALTER TIMESERIES <oldPath> RENAME TO <newPath>
433+
```
434+
435+
Usage instructions:
436+
437+
- This statement takes effect immediately upon successful execution, and the tags/attributes/alias of the original sequence will be migrated to the new sequence.
438+
- The invalidated sequence (original sequence) no longer supports write, query, delete, or other operations. The name of the invalidated sequence will be retained by the system, and creating a new sequence with the same name is not allowed. This ensures the uniqueness and traceability of the original sequence name: it supports viewing the original sequence through the `SHOW INVALID TIMESERIES` statement, preventing the loss of original sequence information due to frequent modifications, significantly improving data traceability and problem localization efficiency.
439+
- The new sequence does not support creating views. When modifying the encoding, compression, sequence type, tags, attributes, or alias of the new sequence, the original sequence will not be modified; deleting the new sequence will also modify the original sequence.
440+
- If the new sequence path or the alias of the original sequence under the target device already exists (including real sequences, views, invalid sequences, and their aliases), the system will report an error.
441+
442+
Usage example:
443+
444+
```sql
445+
ALTER TIMESERIES root.ln.wf01.wt01.temperature RENAME TO root.newln.newwf.newwt.temperature
446+
```
447+
448+
449+
### 2.4 Delete Timeseries
425450

426451
To delete the timeseries we created before, we are able to use `(DELETE | DROP) TimeSeries <PathPattern>` statement.
427452

@@ -434,7 +459,7 @@ delete timeseries root.ln.wf02.*;
434459
drop timeseries root.ln.wf02.*;
435460
```
436461

437-
### 2.4 Show Timeseries
462+
### 2.5 Show Timeseries
438463

439464
* SHOW LATEST? TIMESERIES pathPattern? whereClause? limitClause?
440465

@@ -577,8 +602,23 @@ It costs 0.004s
577602

578603
It is worth noting that when the queried path does not exist, the system will return no timeseries.
579604

605+
- SHOW INVALID TIMESERIES
606+
607+
Since version V2.0.8, this SQL statement is supported to display the invalidated timeseries after a successful full path name modification.
608+
609+
```sql
610+
IoTDB> show invalid timeSeries
611+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
612+
| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| NewPath|
613+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
614+
|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE|root.newln.newwf.newwt.temperature|
615+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
616+
```
617+
618+
Explanation: The last column, "NewPath," in the returned result displays the new sequence corresponding to the invalidated sequence. This serves scenarios such as view construction and cluster migration (Load + rename).
619+
580620

581-
### 2.5 Count Timeseries
621+
### 2.6 Count Timeseries
582622

583623
IoTDB is able to use `COUNT TIMESERIES <Path>` to count the number of timeseries matching the path. SQL statements are as follows:
584624

@@ -663,7 +703,7 @@ It costs 0.002s
663703

664704
> Note: The path of timeseries is just a filter condition, which has no relationship with the definition of level.
665705
666-
### 2.6 Active Timeseries Query
706+
### 2.7 Active Timeseries Query
667707
By adding WHERE time filter conditions to the existing SHOW/COUNT TIMESERIES, we can obtain time series with data within the specified time range.
668708

669709
It is important to note that in metadata queries with time filters, views are not considered; only the time series actually stored in the TsFile are taken into account.
@@ -703,7 +743,7 @@ count timeseries where time >= 15000 and time < 16000;
703743
+-----------------+
704744
```
705745
Regarding the definition of active time series, data that can be queried normally is considered active, meaning time series that have been inserted but deleted are not included.
706-
### 2.7 Tag and Attribute Management
746+
### 2.8 Tag and Attribute Management
707747

708748
We can also add an alias, extra tag and attribute information while creating one timeseries.
709749

0 commit comments

Comments
 (0)