Skip to content

Commit 9a0453d

Browse files
committed
support modify timeseries name from 2082
1 parent 2470294 commit 9a0453d

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
@@ -409,7 +409,32 @@ You can set different datatype, encoding, and compression for the timeseries in
409409

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

412-
### 2.3 Delete Timeseries
412+
### 2.3 Modifying Timeseries Name
413+
414+
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.
415+
416+
Syntax definition:
417+
418+
```sql
419+
-- Supports modifying the full path of a certain sequence to another full path
420+
ALTER TIMESERIES <oldPath> RENAME TO <newPath>
421+
```
422+
423+
Usage instructions:
424+
425+
- This statement takes effect immediately upon successful execution, and the tags/attributes/alias of the original sequence will be migrated to the new sequence.
426+
- 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.
427+
- 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.
428+
- 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.
429+
430+
Usage example:
431+
432+
```sql
433+
ALTER TIMESERIES root.ln.wf01.wt01.temperature RENAME TO root.newln.newwf.newwt.temperature
434+
```
435+
436+
437+
### 2.4 Delete Timeseries
413438

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

@@ -422,7 +447,7 @@ IoTDB> delete timeseries root.ln.wf02.*
422447
IoTDB> drop timeseries root.ln.wf02.*
423448
```
424449

425-
### 2.4 Show Timeseries
450+
### 2.5 Show Timeseries
426451

427452
* SHOW LATEST? TIMESERIES pathPattern? whereClause? limitClause?
428453

@@ -565,8 +590,23 @@ It costs 0.004s
565590

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

593+
- SHOW INVALID TIMESERIES
594+
595+
Since version V2.0.8, this SQL statement is supported to display the invalidated timeseries after a successful full path name modification.
596+
597+
```sql
598+
IoTDB> show invalid timeSeries
599+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
600+
| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| NewPath|
601+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
602+
|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE|root.newln.newwf.newwt.temperature|
603+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
604+
```
605+
606+
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).
607+
568608

569-
### 2.5 Count Timeseries
609+
### 2.6 Count Timeseries
570610

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

@@ -651,7 +691,7 @@ It costs 0.002s
651691

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

657697
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.
@@ -691,7 +731,7 @@ IoTDB> count timeseries where time >= 15000 and time < 16000;
691731
+-----------------+
692732
```
693733
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.
694-
### 2.7 Tag and Attribute Management
734+
### 2.8 Tag and Attribute Management
695735

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

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
IoTDB> 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
IoTDB> delete timeseries root.ln.wf01.wt01.status
@@ -151,17 +159,20 @@ IoTDB> delete timeseries root.ln.wf02.*
151159
IoTDB> drop timeseries root.ln.wf02.*
152160
```
153161

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

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

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

166177
```sql
167178
IoTDB > COUNT TIMESERIES root.**
@@ -178,7 +189,7 @@ IoTDB > COUNT TIMESERIES root.ln.** GROUP BY LEVEL=2
178189
IoTDB > 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
@@ -409,7 +409,32 @@ You can set different datatype, encoding, and compression for the timeseries in
409409

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

412-
### 2.3 Delete Timeseries
412+
### 2.3 Modifying Timeseries Name
413+
414+
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.
415+
416+
Syntax definition:
417+
418+
```sql
419+
-- Supports modifying the full path of a certain sequence to another full path
420+
ALTER TIMESERIES <oldPath> RENAME TO <newPath>
421+
```
422+
423+
Usage instructions:
424+
425+
- This statement takes effect immediately upon successful execution, and the tags/attributes/alias of the original sequence will be migrated to the new sequence.
426+
- 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.
427+
- 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.
428+
- 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.
429+
430+
Usage example:
431+
432+
```sql
433+
ALTER TIMESERIES root.ln.wf01.wt01.temperature RENAME TO root.newln.newwf.newwt.temperature
434+
```
435+
436+
437+
### 2.4 Delete Timeseries
413438

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

@@ -422,7 +447,7 @@ IoTDB> delete timeseries root.ln.wf02.*
422447
IoTDB> drop timeseries root.ln.wf02.*
423448
```
424449

425-
### 2.4 Show Timeseries
450+
### 2.5 Show Timeseries
426451

427452
* SHOW LATEST? TIMESERIES pathPattern? whereClause? limitClause?
428453

@@ -565,8 +590,23 @@ It costs 0.004s
565590

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

593+
- SHOW INVALID TIMESERIES
594+
595+
Since version V2.0.8, this SQL statement is supported to display the invalidated timeseries after a successful full path name modification.
596+
597+
```sql
598+
IoTDB> show invalid timeSeries
599+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
600+
| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| NewPath|
601+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
602+
|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE|root.newln.newwf.newwt.temperature|
603+
+-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+
604+
```
605+
606+
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).
607+
568608

569-
### 2.5 Count Timeseries
609+
### 2.6 Count Timeseries
570610

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

@@ -651,7 +691,7 @@ It costs 0.002s
651691

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

657697
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.
@@ -691,7 +731,7 @@ IoTDB> count timeseries where time >= 15000 and time < 16000;
691731
+-----------------+
692732
```
693733
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.
694-
### 2.7 Tag and Attribute Management
734+
### 2.8 Tag and Attribute Management
695735

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

0 commit comments

Comments
 (0)