This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iotdb-docs.git
The following commit(s) were added to refs/heads/main by this push:
new 676621bc add alter datatype from 2082 to timecho (#1013)
676621bc is described below
commit 676621bc9976b08188b0dc3d2aea9601890cdb37
Author: leto-b <[email protected]>
AuthorDate: Tue Mar 31 17:36:36 2026 +0800
add alter datatype from 2082 to timecho (#1013)
---
.../Basic-Concept/Table-Management_timecho.md | 9 +++-
.../SQL-Manual/SQL-Metadata-Operations_timecho.md | 3 ++
.../Table/User-Manual/Tree-to-Table_timecho.md | 23 +++++++++-
.../Tree/Basic-Concept/Operate-Metadata_timecho.md | 48 ++++++++++++++++++---
src/UserGuide/Master/Tree/SQL-Manual/Keywords.md | 1 +
.../Master/Tree/SQL-Manual/SQL-Manual_timecho.md | 16 ++++---
.../Basic-Concept/Table-Management_timecho.md | 9 +++-
.../SQL-Manual/SQL-Metadata-Operations_timecho.md | 3 ++
.../User-Manual/Tree-to-Table_timecho.md | 23 +++++++++-
.../Basic-Concept/Operate-Metadata_timecho.md | 48 ++++++++++++++++++---
src/UserGuide/latest/SQL-Manual/Keywords.md | 1 +
.../latest/SQL-Manual/SQL-Manual_timecho.md | 16 ++++---
.../Basic-Concept/Table-Management_timecho.md | 22 +++++++++-
.../SQL-Manual/SQL-Metadata-Operations_timecho.md | 3 ++
.../Table/User-Manual/Tree-to-Table_timecho.md | 23 +++++++++-
.../Tree/Basic-Concept/Operate-Metadata_timecho.md | 50 ++++++++++++++++++----
.../UserGuide/Master/Tree/SQL-Manual/Keywords.md | 1 +
.../Master/Tree/SQL-Manual/SQL-Manual_timecho.md | 8 +++-
.../Basic-Concept/Table-Management_timecho.md | 22 +++++++++-
.../SQL-Manual/SQL-Metadata-Operations_timecho.md | 3 ++
.../User-Manual/Tree-to-Table_timecho.md | 23 +++++++++-
.../Basic-Concept/Operate-Metadata_timecho.md | 49 ++++++++++++++++++---
src/zh/UserGuide/latest/SQL-Manual/Keywords.md | 1 +
.../latest/SQL-Manual/SQL-Manual_timecho.md | 8 +++-
24 files changed, 366 insertions(+), 47 deletions(-)
diff --git
a/src/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
b/src/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
index 67e02625..442ef32d 100644
--- a/src/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
+++ b/src/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
@@ -259,7 +259,7 @@ Total line number = 1
### 1.5 Update Tables
-Used to update a table, including adding or deleting columns and configuring
table properties.
+Used to update a table, including adding or deleting columns, modify column
type (V2.0.8.2) and configuring table properties.
**Syntax:**
@@ -273,6 +273,8 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN
(IF NOT EXISTS)? col
| ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES
propertyAssignments;
| COMMENT ON TABLE tableName=qualifiedName IS 'table_comment';
| COMMENT ON COLUMN tableName.column IS 'column_comment';
+#changeColumndatatype;
+| ALTER TABLE (IF EXISTS)? tableName=qualifiedName ALTER COLUMN (IF EXISTS)?
column=identifier SET DATA TYPE new_type=type;
```
**Note::**
@@ -280,6 +282,10 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD
COLUMN (IF NOT EXISTS)? col
1. The `SET PROPERTIES` operation currently only supports configuring the
`TTL` property of a table
2. The delete column function only supports deleting the ATTRIBUTE and FILD
columns, and the TAG column does not support deletion.
3. The modified comment will overwrite the original comment. If null is
specified, the previous comment will be erased.
+4. Since version V2.0.8.2, modifying the data type of a column is supported.
Currently, only columns with Category type FIELD can be modified.
+
+ * If the time series is concurrently deleted during the modification
process, an error will be reported.
+ * The new data type must be compatible with the original type. The specific
compatibility is shown in the following table:
**Example:**
@@ -289,6 +295,7 @@ ALTER TABLE table1 ADD COLUMN IF NOT EXISTS b FLOAT FIELD
COMMENT 'b';
ALTER TABLE table1 set properties TTL=3600;
COMMENT ON TABLE table1 IS 'table1';
COMMENT ON COLUMN table1.a IS null;
+ALTER TABLE table1 ALTER COLUMN IF EXISTS b SET DATA TYPE DOUBLE;
```
### 1.6 Delete Tables
diff --git
a/src/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
b/src/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
index 8e57817d..2c609299 100644
--- a/src/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
+++ b/src/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
@@ -341,6 +341,8 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN
(IF NOT EXISTS)? col
| ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES
propertyAssignments;
| COMMENT ON TABLE tableName=qualifiedName IS 'table_comment';
| COMMENT ON COLUMN tableName.column IS 'column_comment';
+#changeColumndatatype;
+| ALTER TABLE (IF EXISTS)? tableName=qualifiedName ALTER COLUMN (IF EXISTS)?
column=identifier SET DATA TYPE new_type=type;
```
**Examples:**
@@ -351,6 +353,7 @@ ALTER TABLE table1 ADD COLUMN IF NOT EXISTS b FLOAT FIELD
COMMENT 'b';
ALTER TABLE table1 set properties TTL=3600;
COMMENT ON TABLE table1 IS 'table1';
COMMENT ON COLUMN table1.a IS null;
+ALTER TABLE table1 ALTER COLUMN IF EXISTS b SET DATA TYPE DOUBLE;
```
### 2.6 Drop Table
diff --git a/src/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md
b/src/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md
index 85317f1e..d2fbe530 100644
--- a/src/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md
+++ b/src/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md
@@ -161,7 +161,7 @@ AS root.db.**
### 2.2 Modifying a Table View
#### 2.2.1 Syntax Definition
-The ALTER VIEW function supports modifying the view name, adding columns,
renaming columns, deleting columns, setting the view's TTL property, and adding
comments via COMMENT.
+The ALTER VIEW function supports modifying the view name, adding columns,
renaming columns, modifying FIELD column data type (supported since V2.0.8),
deleting columns, setting the view's TTL property, and adding comments via
COMMENT.
```SQL
-- Rename view
@@ -176,6 +176,9 @@ viewColumnDefinition
-- Rename a column in the view
ALTER VIEW [IF EXISTS] viewName RENAME COLUMN [IF EXISTS] oldName TO newName
+-- Modify the data type of a FIELD column
+ALTER VIEW [IF EXISTS] viewName ALTER COLUMN [IF EXISTS] columnName SET DATA
TYPE new_type
+
-- Delete a column from the view
ALTER VIEW [IF EXISTS] viewName DROP COLUMN [IF EXISTS] columnName
@@ -191,6 +194,21 @@ COMMENT ON COLUMN qualifiedName '.' column=identifier IS
(string | NULL) #commen
1. The `SET PROPERTIES`operation currently only supports configuring the TTL
property for the table view.
2. The `DROP COLUMN`function only supports deleting FIELD columns; TAG columns
cannot be deleted.
3. Modifying the comment will overwrite the original comment. If set to
`null`, the previous comment will be erased.
+4. When modifying the data type of a FIELD column, the new data type must be
compatible with the original type. The specific compatibility is shown in the
following table:
+
+| Original Type | Convertible To Type |
+|---------------|----------------------------------------------|
+| INT32 | INT64, FLOAT, DOUBLE, TIMESTAMP, STRING, TEXT |
+| INT64 | TIMESTAMP, DOUBLE, STRING, TEXT |
+| FLOAT | DOUBLE, STRING, TEXT |
+| DOUBLE | STRING, TEXT |
+| BOOLEAN | STRING, TEXT |
+| TEXT | BLOB, STRING |
+| STRING | TEXT, BLOB |
+| BLOB | STRING, TEXT |
+| DATE | STRING, TEXT |
+| TIMESTAMP | INT64, DOUBLE, STRING, TEXT |
+
#### 2.2.3 Usage Examples
```SQL
@@ -203,6 +221,9 @@ ALTER VIEW IF EXISTS tableview ADD COLUMN IF NOT EXISTS
temperature float field
-- Rename a column in the view
ALTER VIEW IF EXISTS tableview RENAME COLUMN IF EXISTS temperature TO temp
+-- Modify the data type of a FIELD column
+ALTER VIEW IF EXISTS tableview ALTER COLUMN IF EXISTS temperature SET DATA
TYPE double
+
-- Delete a column from the view
ALTER VIEW IF EXISTS tableview DROP COLUMN IF EXISTS temp
diff --git
a/src/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_timecho.md
b/src/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_timecho.md
index d85ecff1..2784a126 100644
--- a/src/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_timecho.md
+++ b/src/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_timecho.md
@@ -421,7 +421,43 @@ You can set different datatype, encoding, and compression
for the timeseries in
It is also supported to set an alias, tag, and attribute for aligned
timeseries.
-### 2.3 Modifying Timeseries Name
+
+### 2.3 Modifying Timseries Data Types
+
+Starting from version V2.0.8, modifying the data type of a timeseries via SQL
statements is supported.
+
+Syntax definition:
+
+```SQL
+ALTER TIMESERIES fullPath SET DATA TYPE newType=type
+```
+
+Notes:
+
+* If the timeseries is concurrently deleted during the modification process,
an error will be reported.
+
+* The new data type must be compatible with the original type. The specific
compatibility is shown in the following table:
+
+| Original Type |Convertible To Type |
+| ----------- | ----------------------------------------------- |
+| INT32 | INT64, FLOAT, DOUBLE, TIMESTAMP, STRING, TEXT |
+| INT64 | TIMESTAMP, DOUBLE, STRING, TEXT |
+| FLOAT | DOUBLE, STRING, TEXT |
+| DOUBLE | STRING, TEXT |
+| BOOLEAN | STRING, TEXT |
+| TEXT | BLOB, STRING |
+| STRING | TEXT, BLOB |
+| BLOB | STRING, TEXT |
+| DATE | STRING, TEXT |
+| TIMESTAMP | INT64, DOUBLE, STRING, TEXT |
+
+Usage example:
+
+```SQL
+ALTER TIMESERIES root.ln.wf01.wt01.temperature set data type DOUBLE
+```
+
+### 2.4 Modifying Timeseries Name
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.
@@ -446,7 +482,7 @@ ALTER TIMESERIES root.ln.wf01.wt01.temperature RENAME TO
root.newln.newwf.newwt.
```
-### 2.4 Delete Timeseries
+### 2.5 Delete Timeseries
To delete the timeseries we created before, we are able to use `(DELETE |
DROP) TimeSeries <PathPattern>` statement.
@@ -459,7 +495,7 @@ delete timeseries root.ln.wf02.*;
drop timeseries root.ln.wf02.*;
```
-### 2.5 Show Timeseries
+### 2.6 Show Timeseries
* SHOW LATEST? TIMESERIES pathPattern? whereClause? limitClause?
@@ -618,7 +654,7 @@ IoTDB> show invalid timeSeries
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).
-### 2.6 Count Timeseries
+### 2.7 Count Timeseries
IoTDB is able to use `COUNT TIMESERIES <Path>` to count the number of
timeseries matching the path. SQL statements are as follows:
@@ -703,7 +739,7 @@ It costs 0.002s
> Note: The path of timeseries is just a filter condition, which has no
> relationship with the definition of level.
-### 2.7 Active Timeseries Query
+### 2.8 Active Timeseries Query
By adding WHERE time filter conditions to the existing SHOW/COUNT TIMESERIES,
we can obtain time series with data within the specified time range.
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.
@@ -743,7 +779,7 @@ count timeseries where time >= 15000 and time < 16000;
+-----------------+
```
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.
-### 2.8 Tag and Attribute Management
+### 2.9 Tag and Attribute Management
We can also add an alias, extra tag and attribute information while creating
one timeseries.
diff --git a/src/UserGuide/Master/Tree/SQL-Manual/Keywords.md
b/src/UserGuide/Master/Tree/SQL-Manual/Keywords.md
index b3a2f00b..92164bb8 100644
--- a/src/UserGuide/Master/Tree/SQL-Manual/Keywords.md
+++ b/src/UserGuide/Master/Tree/SQL-Manual/Keywords.md
@@ -208,6 +208,7 @@
- TRIGGER
- TRIGGERS
- TTL
+- TYPE
- UNLINK
- UNLOAD
- UNSET
diff --git a/src/UserGuide/Master/Tree/SQL-Manual/SQL-Manual_timecho.md
b/src/UserGuide/Master/Tree/SQL-Manual/SQL-Manual_timecho.md
index e9641ab3..3f9208ed 100644
--- a/src/UserGuide/Master/Tree/SQL-Manual/SQL-Manual_timecho.md
+++ b/src/UserGuide/Master/Tree/SQL-Manual/SQL-Manual_timecho.md
@@ -142,15 +142,21 @@ error: encoding TS_2DIFF does not support BOOLEAN
CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(latitude FLOAT , longitude FLOAT);
```
-### 2.3 Modify Timeseries Name
+### 2.3 Modify Timeseries Data Type
+> Supported since V2.0.8
+```SQL
+ALTER TIMESERIES root.ln.wf01.wt01.temperature set data type DOUBLE
+```
+
+### 2.4 Modify Timeseries Name
> This statement is supported from V2.0.8 onwards
```sql
ALTER TIMESERIES root.ln.wf01.wt01.temperature RENAME TO
root.newln.newwf.newwt.temperature
```
-### 2.4 Delete Timeseries
+### 2.5 Delete Timeseries
```sql
delete timeseries root.ln.wf01.wt01.status;
@@ -159,7 +165,7 @@ delete timeseries root.ln.wf02.*;
drop timeseries root.ln.wf02.*;
```
-### 2.5 Show Timeseries
+### 2.6 Show Timeseries
```sql
show timeseries root.**;
@@ -172,7 +178,7 @@ show latest timeseries;
show invalid timeseries; -- This statement is supported from V2.0.8.2 onwards;
```
-### 2.6 Count Timeseries
+### 2.7 Count Timeseries
```sql
COUNT TIMESERIES root.**;
@@ -189,7 +195,7 @@ COUNT TIMESERIES root.ln.** GROUP BY LEVEL=2;
COUNT TIMESERIES root.ln.wf01.* GROUP BY LEVEL=2;
```
-### 2.7 Tag and Attribute Management
+### 2.8 Tag and Attribute Management
```sql
create timeseries root.turbine.d1.s1(temprature) with datatype=FLOAT
tags(tag1=v1, tag2=v2) attributes(attr1=v1, attr2=v2);
diff --git
a/src/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md
b/src/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md
index 67e02625..98d80435 100644
--- a/src/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md
+++ b/src/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md
@@ -259,7 +259,7 @@ Total line number = 1
### 1.5 Update Tables
-Used to update a table, including adding or deleting columns and configuring
table properties.
+Used to update a table, including adding or deleting columns, modify column
type (V2.0.8.2) and configuring table properties.
**Syntax:**
@@ -273,6 +273,8 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN
(IF NOT EXISTS)? col
| ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES
propertyAssignments;
| COMMENT ON TABLE tableName=qualifiedName IS 'table_comment';
| COMMENT ON COLUMN tableName.column IS 'column_comment';
+#changeColumndatatype;
+| ALTER TABLE (IF EXISTS)? tableName=qualifiedName ALTER COLUMN (IF EXISTS)?
column=identifier SET DATA TYPE new_type=type;
```
**Note::**
@@ -280,6 +282,10 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD
COLUMN (IF NOT EXISTS)? col
1. The `SET PROPERTIES` operation currently only supports configuring the
`TTL` property of a table
2. The delete column function only supports deleting the ATTRIBUTE and FILD
columns, and the TAG column does not support deletion.
3. The modified comment will overwrite the original comment. If null is
specified, the previous comment will be erased.
+4. Since version V2.0.8.2, modifying the data type of a column is supported.
Currently, only columns with Category type FIELD can be modified.
+
+ * If the time series is concurrently deleted during the modification
process, an error will be reported.
+ * The new data type must be compatible with the original type. The specific
compatibility is shown in the following table:
**Example:**
@@ -289,6 +295,7 @@ ALTER TABLE table1 ADD COLUMN IF NOT EXISTS b FLOAT FIELD
COMMENT 'b';
ALTER TABLE table1 set properties TTL=3600;
COMMENT ON TABLE table1 IS 'table1';
COMMENT ON COLUMN table1.a IS null;
+ALTER TABLE table1 ALTER COLUMN IF EXISTS b SET DATA TYPE DOUBLE;
```
### 1.6 Delete Tables
diff --git
a/src/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
b/src/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
index 8e57817d..2c609299 100644
--- a/src/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
+++ b/src/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
@@ -341,6 +341,8 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN
(IF NOT EXISTS)? col
| ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES
propertyAssignments;
| COMMENT ON TABLE tableName=qualifiedName IS 'table_comment';
| COMMENT ON COLUMN tableName.column IS 'column_comment';
+#changeColumndatatype;
+| ALTER TABLE (IF EXISTS)? tableName=qualifiedName ALTER COLUMN (IF EXISTS)?
column=identifier SET DATA TYPE new_type=type;
```
**Examples:**
@@ -351,6 +353,7 @@ ALTER TABLE table1 ADD COLUMN IF NOT EXISTS b FLOAT FIELD
COMMENT 'b';
ALTER TABLE table1 set properties TTL=3600;
COMMENT ON TABLE table1 IS 'table1';
COMMENT ON COLUMN table1.a IS null;
+ALTER TABLE table1 ALTER COLUMN IF EXISTS b SET DATA TYPE DOUBLE;
```
### 2.6 Drop Table
diff --git a/src/UserGuide/latest-Table/User-Manual/Tree-to-Table_timecho.md
b/src/UserGuide/latest-Table/User-Manual/Tree-to-Table_timecho.md
index 85317f1e..d2fbe530 100644
--- a/src/UserGuide/latest-Table/User-Manual/Tree-to-Table_timecho.md
+++ b/src/UserGuide/latest-Table/User-Manual/Tree-to-Table_timecho.md
@@ -161,7 +161,7 @@ AS root.db.**
### 2.2 Modifying a Table View
#### 2.2.1 Syntax Definition
-The ALTER VIEW function supports modifying the view name, adding columns,
renaming columns, deleting columns, setting the view's TTL property, and adding
comments via COMMENT.
+The ALTER VIEW function supports modifying the view name, adding columns,
renaming columns, modifying FIELD column data type (supported since V2.0.8),
deleting columns, setting the view's TTL property, and adding comments via
COMMENT.
```SQL
-- Rename view
@@ -176,6 +176,9 @@ viewColumnDefinition
-- Rename a column in the view
ALTER VIEW [IF EXISTS] viewName RENAME COLUMN [IF EXISTS] oldName TO newName
+-- Modify the data type of a FIELD column
+ALTER VIEW [IF EXISTS] viewName ALTER COLUMN [IF EXISTS] columnName SET DATA
TYPE new_type
+
-- Delete a column from the view
ALTER VIEW [IF EXISTS] viewName DROP COLUMN [IF EXISTS] columnName
@@ -191,6 +194,21 @@ COMMENT ON COLUMN qualifiedName '.' column=identifier IS
(string | NULL) #commen
1. The `SET PROPERTIES`operation currently only supports configuring the TTL
property for the table view.
2. The `DROP COLUMN`function only supports deleting FIELD columns; TAG columns
cannot be deleted.
3. Modifying the comment will overwrite the original comment. If set to
`null`, the previous comment will be erased.
+4. When modifying the data type of a FIELD column, the new data type must be
compatible with the original type. The specific compatibility is shown in the
following table:
+
+| Original Type | Convertible To Type |
+|---------------|----------------------------------------------|
+| INT32 | INT64, FLOAT, DOUBLE, TIMESTAMP, STRING, TEXT |
+| INT64 | TIMESTAMP, DOUBLE, STRING, TEXT |
+| FLOAT | DOUBLE, STRING, TEXT |
+| DOUBLE | STRING, TEXT |
+| BOOLEAN | STRING, TEXT |
+| TEXT | BLOB, STRING |
+| STRING | TEXT, BLOB |
+| BLOB | STRING, TEXT |
+| DATE | STRING, TEXT |
+| TIMESTAMP | INT64, DOUBLE, STRING, TEXT |
+
#### 2.2.3 Usage Examples
```SQL
@@ -203,6 +221,9 @@ ALTER VIEW IF EXISTS tableview ADD COLUMN IF NOT EXISTS
temperature float field
-- Rename a column in the view
ALTER VIEW IF EXISTS tableview RENAME COLUMN IF EXISTS temperature TO temp
+-- Modify the data type of a FIELD column
+ALTER VIEW IF EXISTS tableview ALTER COLUMN IF EXISTS temperature SET DATA
TYPE double
+
-- Delete a column from the view
ALTER VIEW IF EXISTS tableview DROP COLUMN IF EXISTS temp
diff --git a/src/UserGuide/latest/Basic-Concept/Operate-Metadata_timecho.md
b/src/UserGuide/latest/Basic-Concept/Operate-Metadata_timecho.md
index d85ecff1..2784a126 100644
--- a/src/UserGuide/latest/Basic-Concept/Operate-Metadata_timecho.md
+++ b/src/UserGuide/latest/Basic-Concept/Operate-Metadata_timecho.md
@@ -421,7 +421,43 @@ You can set different datatype, encoding, and compression
for the timeseries in
It is also supported to set an alias, tag, and attribute for aligned
timeseries.
-### 2.3 Modifying Timeseries Name
+
+### 2.3 Modifying Timseries Data Types
+
+Starting from version V2.0.8, modifying the data type of a timeseries via SQL
statements is supported.
+
+Syntax definition:
+
+```SQL
+ALTER TIMESERIES fullPath SET DATA TYPE newType=type
+```
+
+Notes:
+
+* If the timeseries is concurrently deleted during the modification process,
an error will be reported.
+
+* The new data type must be compatible with the original type. The specific
compatibility is shown in the following table:
+
+| Original Type |Convertible To Type |
+| ----------- | ----------------------------------------------- |
+| INT32 | INT64, FLOAT, DOUBLE, TIMESTAMP, STRING, TEXT |
+| INT64 | TIMESTAMP, DOUBLE, STRING, TEXT |
+| FLOAT | DOUBLE, STRING, TEXT |
+| DOUBLE | STRING, TEXT |
+| BOOLEAN | STRING, TEXT |
+| TEXT | BLOB, STRING |
+| STRING | TEXT, BLOB |
+| BLOB | STRING, TEXT |
+| DATE | STRING, TEXT |
+| TIMESTAMP | INT64, DOUBLE, STRING, TEXT |
+
+Usage example:
+
+```SQL
+ALTER TIMESERIES root.ln.wf01.wt01.temperature set data type DOUBLE
+```
+
+### 2.4 Modifying Timeseries Name
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.
@@ -446,7 +482,7 @@ ALTER TIMESERIES root.ln.wf01.wt01.temperature RENAME TO
root.newln.newwf.newwt.
```
-### 2.4 Delete Timeseries
+### 2.5 Delete Timeseries
To delete the timeseries we created before, we are able to use `(DELETE |
DROP) TimeSeries <PathPattern>` statement.
@@ -459,7 +495,7 @@ delete timeseries root.ln.wf02.*;
drop timeseries root.ln.wf02.*;
```
-### 2.5 Show Timeseries
+### 2.6 Show Timeseries
* SHOW LATEST? TIMESERIES pathPattern? whereClause? limitClause?
@@ -618,7 +654,7 @@ IoTDB> show invalid timeSeries
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).
-### 2.6 Count Timeseries
+### 2.7 Count Timeseries
IoTDB is able to use `COUNT TIMESERIES <Path>` to count the number of
timeseries matching the path. SQL statements are as follows:
@@ -703,7 +739,7 @@ It costs 0.002s
> Note: The path of timeseries is just a filter condition, which has no
> relationship with the definition of level.
-### 2.7 Active Timeseries Query
+### 2.8 Active Timeseries Query
By adding WHERE time filter conditions to the existing SHOW/COUNT TIMESERIES,
we can obtain time series with data within the specified time range.
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.
@@ -743,7 +779,7 @@ count timeseries where time >= 15000 and time < 16000;
+-----------------+
```
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.
-### 2.8 Tag and Attribute Management
+### 2.9 Tag and Attribute Management
We can also add an alias, extra tag and attribute information while creating
one timeseries.
diff --git a/src/UserGuide/latest/SQL-Manual/Keywords.md
b/src/UserGuide/latest/SQL-Manual/Keywords.md
index b3a2f00b..92164bb8 100644
--- a/src/UserGuide/latest/SQL-Manual/Keywords.md
+++ b/src/UserGuide/latest/SQL-Manual/Keywords.md
@@ -208,6 +208,7 @@
- TRIGGER
- TRIGGERS
- TTL
+- TYPE
- UNLINK
- UNLOAD
- UNSET
diff --git a/src/UserGuide/latest/SQL-Manual/SQL-Manual_timecho.md
b/src/UserGuide/latest/SQL-Manual/SQL-Manual_timecho.md
index e9641ab3..3f9208ed 100644
--- a/src/UserGuide/latest/SQL-Manual/SQL-Manual_timecho.md
+++ b/src/UserGuide/latest/SQL-Manual/SQL-Manual_timecho.md
@@ -142,15 +142,21 @@ error: encoding TS_2DIFF does not support BOOLEAN
CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(latitude FLOAT , longitude FLOAT);
```
-### 2.3 Modify Timeseries Name
+### 2.3 Modify Timeseries Data Type
+> Supported since V2.0.8
+```SQL
+ALTER TIMESERIES root.ln.wf01.wt01.temperature set data type DOUBLE
+```
+
+### 2.4 Modify Timeseries Name
> This statement is supported from V2.0.8 onwards
```sql
ALTER TIMESERIES root.ln.wf01.wt01.temperature RENAME TO
root.newln.newwf.newwt.temperature
```
-### 2.4 Delete Timeseries
+### 2.5 Delete Timeseries
```sql
delete timeseries root.ln.wf01.wt01.status;
@@ -159,7 +165,7 @@ delete timeseries root.ln.wf02.*;
drop timeseries root.ln.wf02.*;
```
-### 2.5 Show Timeseries
+### 2.6 Show Timeseries
```sql
show timeseries root.**;
@@ -172,7 +178,7 @@ show latest timeseries;
show invalid timeseries; -- This statement is supported from V2.0.8.2 onwards;
```
-### 2.6 Count Timeseries
+### 2.7 Count Timeseries
```sql
COUNT TIMESERIES root.**;
@@ -189,7 +195,7 @@ COUNT TIMESERIES root.ln.** GROUP BY LEVEL=2;
COUNT TIMESERIES root.ln.wf01.* GROUP BY LEVEL=2;
```
-### 2.7 Tag and Attribute Management
+### 2.8 Tag and Attribute Management
```sql
create timeseries root.turbine.d1.s1(temprature) with datatype=FLOAT
tags(tag1=v1, tag2=v2) attributes(attr1=v1, attr2=v2);
diff --git
a/src/zh/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
b/src/zh/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
index ec5dab12..60b3100c 100644
--- a/src/zh/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
+++ b/src/zh/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
@@ -256,7 +256,7 @@ Total line number = 1
### 1.5 修改表
-用于修改表,包括添加列、删除列以及设置表的属性。
+用于修改表,包括添加列、删除列、修改列类型(V2.0.8.2)以及设置表的属性。
**语法:**
@@ -270,6 +270,8 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName DROP
COLUMN (IF EXISTS)? column
| ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES
propertyAssignments;
| COMMENT ON TABLE tableName=qualifiedName IS 'table_comment';
| COMMENT ON COLUMN tableName.column IS 'column_comment';
+#changeColumndatatype;
+| ALTER TABLE (IF EXISTS)? tableName=qualifiedName ALTER COLUMN (IF EXISTS)?
column=identifier SET DATA TYPE new_type=type;
```
**说明:**
@@ -277,6 +279,23 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName DROP
COLUMN (IF EXISTS)? column
1. `SET PROPERTIES`操作目前仅支持对表的 TTL 属性进行配置。
2. 删除列功能,仅支持删除属性列(ATTRIBUTE)和物理量列(FIELD),标识列(TAG)不支持删除。
3. 修改后的 comment 会覆盖原有注释,如果指定为 null,则会擦除之前的 comment。
+4. 自 V2.0.8.2 版本起支持修改字段数据类型,目前只支持修改Category类型为FIELD的字段。
+ - 变更过程中若该时间序列被并发删除,会报错提示。
+ - 变更后的字段类型需要与原类型兼容,具体兼容性如下表所示:
+
+| 原始类型 | 可变更为类型 |
+| ----------- | ----------------------------------------------- |
+| INT32 | INT64, FLOAT, DOUBLE, TIMESTAMP, STRING, TEXT |
+| INT64 | TIMESTAMP, DOUBLE, STRING, TEXT |
+| FLOAT | DOUBLE, STRING, TEXT |
+| DOUBLE | STRING, TEXT |
+| BOOLEAN | STRING, TEXT |
+| TEXT | BLOB, STRING |
+| STRING | TEXT, BLOB |
+| BLOB | STRING, TEXT |
+| DATE | STRING, TEXT |
+| TIMESTAMP | INT64, DOUBLE, STRING, TEXT |
+
**示例:**
@@ -286,6 +305,7 @@ ALTER TABLE table1 ADD COLUMN IF NOT EXISTS b FLOAT FIELD
COMMENT 'b';
ALTER TABLE table1 set properties TTL=3600;
COMMENT ON TABLE table1 IS 'table1';
COMMENT ON COLUMN table1.a IS null;
+ALTER TABLE table1 ALTER COLUMN IF EXISTS b SET DATA TYPE DOUBLE;
```
### 1.6 删除表
diff --git
a/src/zh/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
b/src/zh/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
index e99fbeea..6bc003d9 100644
---
a/src/zh/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
+++
b/src/zh/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
@@ -338,6 +338,8 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN
(IF NOT EXISTS)? col
| ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES
propertyAssignments;
| COMMENT ON TABLE tableName=qualifiedName IS 'table_comment';
| COMMENT ON COLUMN tableName.column IS 'column_comment';
+#changeColumndatatype;
+| ALTER TABLE (IF EXISTS)? tableName=qualifiedName ALTER COLUMN (IF EXISTS)?
column=identifier SET DATA TYPE new_type=type;
```
**示例:**
@@ -348,6 +350,7 @@ ALTER TABLE table1 ADD COLUMN IF NOT EXISTS b FLOAT FIELD
COMMENT 'b';
ALTER TABLE table1 set properties TTL=3600;
COMMENT ON TABLE table1 IS 'table1';
COMMENT ON COLUMN table1.a IS null;
+ALTER TABLE table1 ALTER COLUMN IF EXISTS b SET DATA TYPE DOUBLE;
```
### 2.6 删除表
diff --git a/src/zh/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md
b/src/zh/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md
index f8ba56c9..5d7ae3c5 100644
--- a/src/zh/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md
+++ b/src/zh/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md
@@ -158,7 +158,7 @@ with (ttl=604800000)
### 2.2 修改表视图
#### 2.2.1 语法定义
-修改表视图功能支持修改视图名称、添加列、列重命名、删除列、设置视图的 TTL 属性,以及通过 COMMENT 添加注释。
+修改表视图功能支持修改视图名称、添加列、列重命名、修改 FIELD 列数据类型(V2.0.8 起支持)、删除列、设置视图的 TTL 属性,以及通过
COMMENT 添加注释。
```SQL
-- 修改视图名
@@ -173,6 +173,9 @@ viewColumnDefinition
-- 为视图中的某一列重命名
ALTER VIEW [IF EXISTS] viewName RENAME COLUMN [IF EXISTS] oldName TO newName
+--修改 FIELD 列的数据类型
+ALTER VIEW [IF EXISTS] viewName ALTER COLUMN [IF EXISTS] columnName SET DATA
TYPE new_type
+
-- 删除视图中的某一列
ALTER VIEW [IF EXISTS] viewName DROP COLUMN [IF EXISTS] columnName
@@ -188,6 +191,21 @@ COMMENT ON COLUMN qualifiedName '.' column=identifier IS
(string | NULL) #commen
1. `SET PROPERTIES`操作目前仅支持对表视图的 TTL 属性进行配置。
2. 删除列功能,仅支持删除物理量列(FIELD),标识列(TAG)不支持删除。
3. 修改后的 comment 会覆盖原有注释,如果指定为 null,则会擦除之前的 comment。
+4. 修改 FIELD 列数据类型时,变更后的字段类型需要与原类型兼容,具体兼容性如下表所示:
+
+| 原始类型 | 可变更为类型 |
+| ----------- | ----------------------------------------------- |
+| INT32 | INT64, FLOAT, DOUBLE, TIMESTAMP, STRING, TEXT |
+| INT64 | TIMESTAMP, DOUBLE, STRING, TEXT |
+| FLOAT | DOUBLE, STRING, TEXT |
+| DOUBLE | STRING, TEXT |
+| BOOLEAN | STRING, TEXT |
+| TEXT | BLOB, STRING |
+| STRING | TEXT, BLOB |
+| BLOB | STRING, TEXT |
+| DATE | STRING, TEXT |
+| TIMESTAMP | INT64, DOUBLE, STRING, TEXT |
+
#### 2.2.3 使用示例
```SQL
@@ -200,6 +218,9 @@ ALTER VIEW IF EXISTS tableview ADD COLUMN IF NOT EXISTS
temperature float field
-- 为视图中的某一列重命名
ALTER VIEW IF EXISTS tableview RENAME COLUMN IF EXISTS temperature TO temp
+-- 修改 FIELD 列的数据类型
+ALTER VIEW IF EXISTS tableview ALTER COLUMN IF EXISTS temperature SET DATA
TYPE double
+
-- 删除视图中的某一列
ALTER VIEW IF EXISTS tableview DROP COLUMN IF EXISTS temp
diff --git
a/src/zh/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_timecho.md
b/src/zh/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_timecho.md
index 8cccaa45..3ffe571b 100644
--- a/src/zh/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_timecho.md
+++ b/src/zh/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_timecho.md
@@ -405,7 +405,42 @@ CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(latitude FLOAT,
longitude FLOAT);
对齐的时间序列也支持设置别名、标签、属性。
-### 2.3 修改时间序列名称
+
+### 2.3 修改时间序列数据类型
+
+自 V2.0.8 版本起,支持通过 SQL 语句修改时间序列的数据类型。
+
+语法定义:
+
+```SQL
+ALTER TIMESERIES fullPath SET DATA TYPE newType=type
+```
+
+说明:
+
+* 变更过程中若该时间序列被并发删除,会报错提示。
+* 变更后的时间序列类型需要与原类型兼容,具体兼容性如下表所示:
+
+| 原始类型 | 可变更为类型 |
+| ----------- | ----------------------------------------------- |
+| INT32 | INT64, FLOAT, DOUBLE, TIMESTAMP, STRING, TEXT |
+| INT64 | TIMESTAMP, DOUBLE, STRING, TEXT |
+| FLOAT | DOUBLE, STRING, TEXT |
+| DOUBLE | STRING, TEXT |
+| BOOLEAN | STRING, TEXT |
+| TEXT | BLOB, STRING |
+| STRING | TEXT, BLOB |
+| BLOB | STRING, TEXT |
+| DATE | STRING, TEXT |
+| TIMESTAMP | INT64, DOUBLE, STRING, TEXT |
+
+使用示例:
+
+```SQL
+ALTER TIMESERIES root.ln.wf01.wt01.temperature set data type DOUBLE;
+```
+
+### 2.4 修改时间序列名称
自 V2.0.8 版本起,支持通过 SQL 语句修改时间序列的全路径名称。修改成功后,原有名称作废,但仍在元数据的存储中。
@@ -426,11 +461,10 @@ ALTER TIMESERIES <oldPath> RENAME TO <newPath>
使用示例:
```SQL
-ALTER TIMESERIES root.ln.wf01.wt01.temperature RENAME TO
root.newln.newwf.newwt.temperature
+ALTER TIMESERIES root.ln.wf01.wt01.temperature RENAME TO
root.newln.newwf.newwt.temperature;
```
-
-### 2.4 删除时间序列
+### 2.5 删除时间序列
我们可以使用`(DELETE | DROP) TimeSeries <PathPattern>`语句来删除我们之前创建的时间序列。SQL 语句如下所示:
@@ -441,7 +475,7 @@ delete timeseries root.ln.wf02.*;
drop timeseries root.ln.wf02.*;
```
-### 2.5 查看时间序列
+### 2.6 查看时间序列
* SHOW LATEST? TIMESERIES pathPattern? timeseriesWhereClause? limitClause?
@@ -598,7 +632,7 @@ IoTDB> show invalid timeSeries
说明:返回结果中的最后一列 `NewPath`,展示作废序列对应的新序列,以服务于视图构建、集群迁移(Load+改名)等场景。
-### 2.6 统计时间序列总数
+### 2.7 统计时间序列总数
IoTDB 支持使用`COUNT TIMESERIES<Path>`来统计一条路径中的时间序列个数。SQL 语句如下所示:
@@ -687,7 +721,7 @@ It costs 0.002s
> 注意:时间序列的路径只是过滤条件,与 level 的定义无关。
-### 2.7 活跃时间序列查询
+### 2.8 活跃时间序列查询
我们在原有的时间序列查询和统计上添加新的WHERE时间过滤条件,可以得到在指定时间范围中存在数据的时间序列。
需要注意的是, 在带有时间过滤的元数据查询中并不考虑视图的存在,只考虑TsFile中实际存储的时间序列。
@@ -730,7 +764,7 @@ count timeseries where time >= 15000 and time < 16000;
```
关于活跃时间序列的定义,能通过正常查询查出来的数据就是活跃数据,也就是说插入但被删除的时间序列不在考虑范围内。
-### 2.8 标签点管理
+### 2.9 标签点管理
我们可以在创建时间序列的时候,为它添加别名和额外的标签和属性信息。
diff --git a/src/zh/UserGuide/Master/Tree/SQL-Manual/Keywords.md
b/src/zh/UserGuide/Master/Tree/SQL-Manual/Keywords.md
index 4064b94c..9aa3ced7 100644
--- a/src/zh/UserGuide/Master/Tree/SQL-Manual/Keywords.md
+++ b/src/zh/UserGuide/Master/Tree/SQL-Manual/Keywords.md
@@ -208,6 +208,7 @@
- TRIGGER
- TRIGGERS
- TTL
+- TYPE
- UNLINK
- UNLOAD
- UNSET
diff --git a/src/zh/UserGuide/Master/Tree/SQL-Manual/SQL-Manual_timecho.md
b/src/zh/UserGuide/Master/Tree/SQL-Manual/SQL-Manual_timecho.md
index f2f82df1..deb356f6 100644
--- a/src/zh/UserGuide/Master/Tree/SQL-Manual/SQL-Manual_timecho.md
+++ b/src/zh/UserGuide/Master/Tree/SQL-Manual/SQL-Manual_timecho.md
@@ -72,8 +72,14 @@ create timeseries root.ln.wf02.wt02.status WITH
DATATYPE=BOOLEAN;
CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(latitude FLOAT, longitude FLOAT);
```
-#### 修改时间序列名称
+#### 修改时间序列数据类型
+> V2.0.8 起支持该语句
+
+```sql
+ALTER TIMESERIES root.ln.wf01.wt01.temperature set data type DOUBLE
+```
+#### 修改时间序列名称
> V2.0.8 起支持该语句
```SQL
diff --git
a/src/zh/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md
b/src/zh/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md
index ec5dab12..60b3100c 100644
--- a/src/zh/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md
+++ b/src/zh/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md
@@ -256,7 +256,7 @@ Total line number = 1
### 1.5 修改表
-用于修改表,包括添加列、删除列以及设置表的属性。
+用于修改表,包括添加列、删除列、修改列类型(V2.0.8.2)以及设置表的属性。
**语法:**
@@ -270,6 +270,8 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName DROP
COLUMN (IF EXISTS)? column
| ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES
propertyAssignments;
| COMMENT ON TABLE tableName=qualifiedName IS 'table_comment';
| COMMENT ON COLUMN tableName.column IS 'column_comment';
+#changeColumndatatype;
+| ALTER TABLE (IF EXISTS)? tableName=qualifiedName ALTER COLUMN (IF EXISTS)?
column=identifier SET DATA TYPE new_type=type;
```
**说明:**
@@ -277,6 +279,23 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName DROP
COLUMN (IF EXISTS)? column
1. `SET PROPERTIES`操作目前仅支持对表的 TTL 属性进行配置。
2. 删除列功能,仅支持删除属性列(ATTRIBUTE)和物理量列(FIELD),标识列(TAG)不支持删除。
3. 修改后的 comment 会覆盖原有注释,如果指定为 null,则会擦除之前的 comment。
+4. 自 V2.0.8.2 版本起支持修改字段数据类型,目前只支持修改Category类型为FIELD的字段。
+ - 变更过程中若该时间序列被并发删除,会报错提示。
+ - 变更后的字段类型需要与原类型兼容,具体兼容性如下表所示:
+
+| 原始类型 | 可变更为类型 |
+| ----------- | ----------------------------------------------- |
+| INT32 | INT64, FLOAT, DOUBLE, TIMESTAMP, STRING, TEXT |
+| INT64 | TIMESTAMP, DOUBLE, STRING, TEXT |
+| FLOAT | DOUBLE, STRING, TEXT |
+| DOUBLE | STRING, TEXT |
+| BOOLEAN | STRING, TEXT |
+| TEXT | BLOB, STRING |
+| STRING | TEXT, BLOB |
+| BLOB | STRING, TEXT |
+| DATE | STRING, TEXT |
+| TIMESTAMP | INT64, DOUBLE, STRING, TEXT |
+
**示例:**
@@ -286,6 +305,7 @@ ALTER TABLE table1 ADD COLUMN IF NOT EXISTS b FLOAT FIELD
COMMENT 'b';
ALTER TABLE table1 set properties TTL=3600;
COMMENT ON TABLE table1 IS 'table1';
COMMENT ON COLUMN table1.a IS null;
+ALTER TABLE table1 ALTER COLUMN IF EXISTS b SET DATA TYPE DOUBLE;
```
### 1.6 删除表
diff --git
a/src/zh/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
b/src/zh/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
index e99fbeea..6bc003d9 100644
---
a/src/zh/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
+++
b/src/zh/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
@@ -338,6 +338,8 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN
(IF NOT EXISTS)? col
| ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES
propertyAssignments;
| COMMENT ON TABLE tableName=qualifiedName IS 'table_comment';
| COMMENT ON COLUMN tableName.column IS 'column_comment';
+#changeColumndatatype;
+| ALTER TABLE (IF EXISTS)? tableName=qualifiedName ALTER COLUMN (IF EXISTS)?
column=identifier SET DATA TYPE new_type=type;
```
**示例:**
@@ -348,6 +350,7 @@ ALTER TABLE table1 ADD COLUMN IF NOT EXISTS b FLOAT FIELD
COMMENT 'b';
ALTER TABLE table1 set properties TTL=3600;
COMMENT ON TABLE table1 IS 'table1';
COMMENT ON COLUMN table1.a IS null;
+ALTER TABLE table1 ALTER COLUMN IF EXISTS b SET DATA TYPE DOUBLE;
```
### 2.6 删除表
diff --git a/src/zh/UserGuide/latest-Table/User-Manual/Tree-to-Table_timecho.md
b/src/zh/UserGuide/latest-Table/User-Manual/Tree-to-Table_timecho.md
index f8ba56c9..5d7ae3c5 100644
--- a/src/zh/UserGuide/latest-Table/User-Manual/Tree-to-Table_timecho.md
+++ b/src/zh/UserGuide/latest-Table/User-Manual/Tree-to-Table_timecho.md
@@ -158,7 +158,7 @@ with (ttl=604800000)
### 2.2 修改表视图
#### 2.2.1 语法定义
-修改表视图功能支持修改视图名称、添加列、列重命名、删除列、设置视图的 TTL 属性,以及通过 COMMENT 添加注释。
+修改表视图功能支持修改视图名称、添加列、列重命名、修改 FIELD 列数据类型(V2.0.8 起支持)、删除列、设置视图的 TTL 属性,以及通过
COMMENT 添加注释。
```SQL
-- 修改视图名
@@ -173,6 +173,9 @@ viewColumnDefinition
-- 为视图中的某一列重命名
ALTER VIEW [IF EXISTS] viewName RENAME COLUMN [IF EXISTS] oldName TO newName
+--修改 FIELD 列的数据类型
+ALTER VIEW [IF EXISTS] viewName ALTER COLUMN [IF EXISTS] columnName SET DATA
TYPE new_type
+
-- 删除视图中的某一列
ALTER VIEW [IF EXISTS] viewName DROP COLUMN [IF EXISTS] columnName
@@ -188,6 +191,21 @@ COMMENT ON COLUMN qualifiedName '.' column=identifier IS
(string | NULL) #commen
1. `SET PROPERTIES`操作目前仅支持对表视图的 TTL 属性进行配置。
2. 删除列功能,仅支持删除物理量列(FIELD),标识列(TAG)不支持删除。
3. 修改后的 comment 会覆盖原有注释,如果指定为 null,则会擦除之前的 comment。
+4. 修改 FIELD 列数据类型时,变更后的字段类型需要与原类型兼容,具体兼容性如下表所示:
+
+| 原始类型 | 可变更为类型 |
+| ----------- | ----------------------------------------------- |
+| INT32 | INT64, FLOAT, DOUBLE, TIMESTAMP, STRING, TEXT |
+| INT64 | TIMESTAMP, DOUBLE, STRING, TEXT |
+| FLOAT | DOUBLE, STRING, TEXT |
+| DOUBLE | STRING, TEXT |
+| BOOLEAN | STRING, TEXT |
+| TEXT | BLOB, STRING |
+| STRING | TEXT, BLOB |
+| BLOB | STRING, TEXT |
+| DATE | STRING, TEXT |
+| TIMESTAMP | INT64, DOUBLE, STRING, TEXT |
+
#### 2.2.3 使用示例
```SQL
@@ -200,6 +218,9 @@ ALTER VIEW IF EXISTS tableview ADD COLUMN IF NOT EXISTS
temperature float field
-- 为视图中的某一列重命名
ALTER VIEW IF EXISTS tableview RENAME COLUMN IF EXISTS temperature TO temp
+-- 修改 FIELD 列的数据类型
+ALTER VIEW IF EXISTS tableview ALTER COLUMN IF EXISTS temperature SET DATA
TYPE double
+
-- 删除视图中的某一列
ALTER VIEW IF EXISTS tableview DROP COLUMN IF EXISTS temp
diff --git a/src/zh/UserGuide/latest/Basic-Concept/Operate-Metadata_timecho.md
b/src/zh/UserGuide/latest/Basic-Concept/Operate-Metadata_timecho.md
index 8cccaa45..8ad637a6 100644
--- a/src/zh/UserGuide/latest/Basic-Concept/Operate-Metadata_timecho.md
+++ b/src/zh/UserGuide/latest/Basic-Concept/Operate-Metadata_timecho.md
@@ -405,7 +405,42 @@ CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(latitude FLOAT,
longitude FLOAT);
对齐的时间序列也支持设置别名、标签、属性。
-### 2.3 修改时间序列名称
+
+### 2.3 修改时间序列数据类型
+
+自 V2.0.8 版本起,支持通过 SQL 语句修改时间序列的数据类型。
+
+语法定义:
+
+```SQL
+ALTER TIMESERIES fullPath SET DATA TYPE newType=type
+```
+
+说明:
+
+* 变更过程中若该时间序列被并发删除,会报错提示。
+* 变更后的时间序列类型需要与原类型兼容,具体兼容性如下表所示:
+
+| 原始类型 | 可变更为类型 |
+| ----------- | ----------------------------------------------- |
+| INT32 | INT64, FLOAT, DOUBLE, TIMESTAMP, STRING, TEXT |
+| INT64 | TIMESTAMP, DOUBLE, STRING, TEXT |
+| FLOAT | DOUBLE, STRING, TEXT |
+| DOUBLE | STRING, TEXT |
+| BOOLEAN | STRING, TEXT |
+| TEXT | BLOB, STRING |
+| STRING | TEXT, BLOB |
+| BLOB | STRING, TEXT |
+| DATE | STRING, TEXT |
+| TIMESTAMP | INT64, DOUBLE, STRING, TEXT |
+
+使用示例:
+
+```SQL
+ALTER TIMESERIES root.ln.wf01.wt01.temperature set data type DOUBLE;
+```
+
+### 2.4 修改时间序列名称
自 V2.0.8 版本起,支持通过 SQL 语句修改时间序列的全路径名称。修改成功后,原有名称作废,但仍在元数据的存储中。
@@ -426,11 +461,11 @@ ALTER TIMESERIES <oldPath> RENAME TO <newPath>
使用示例:
```SQL
-ALTER TIMESERIES root.ln.wf01.wt01.temperature RENAME TO
root.newln.newwf.newwt.temperature
+ALTER TIMESERIES root.ln.wf01.wt01.temperature RENAME TO
root.newln.newwf.newwt.temperature;
```
-### 2.4 删除时间序列
+### 2.5 删除时间序列
我们可以使用`(DELETE | DROP) TimeSeries <PathPattern>`语句来删除我们之前创建的时间序列。SQL 语句如下所示:
@@ -441,7 +476,7 @@ delete timeseries root.ln.wf02.*;
drop timeseries root.ln.wf02.*;
```
-### 2.5 查看时间序列
+### 2.6 查看时间序列
* SHOW LATEST? TIMESERIES pathPattern? timeseriesWhereClause? limitClause?
@@ -598,7 +633,7 @@ IoTDB> show invalid timeSeries
说明:返回结果中的最后一列 `NewPath`,展示作废序列对应的新序列,以服务于视图构建、集群迁移(Load+改名)等场景。
-### 2.6 统计时间序列总数
+### 2.7 统计时间序列总数
IoTDB 支持使用`COUNT TIMESERIES<Path>`来统计一条路径中的时间序列个数。SQL 语句如下所示:
@@ -687,7 +722,7 @@ It costs 0.002s
> 注意:时间序列的路径只是过滤条件,与 level 的定义无关。
-### 2.7 活跃时间序列查询
+### 2.8 活跃时间序列查询
我们在原有的时间序列查询和统计上添加新的WHERE时间过滤条件,可以得到在指定时间范围中存在数据的时间序列。
需要注意的是, 在带有时间过滤的元数据查询中并不考虑视图的存在,只考虑TsFile中实际存储的时间序列。
@@ -730,7 +765,7 @@ count timeseries where time >= 15000 and time < 16000;
```
关于活跃时间序列的定义,能通过正常查询查出来的数据就是活跃数据,也就是说插入但被删除的时间序列不在考虑范围内。
-### 2.8 标签点管理
+### 2.9 标签点管理
我们可以在创建时间序列的时候,为它添加别名和额外的标签和属性信息。
diff --git a/src/zh/UserGuide/latest/SQL-Manual/Keywords.md
b/src/zh/UserGuide/latest/SQL-Manual/Keywords.md
index 4064b94c..9aa3ced7 100644
--- a/src/zh/UserGuide/latest/SQL-Manual/Keywords.md
+++ b/src/zh/UserGuide/latest/SQL-Manual/Keywords.md
@@ -208,6 +208,7 @@
- TRIGGER
- TRIGGERS
- TTL
+- TYPE
- UNLINK
- UNLOAD
- UNSET
diff --git a/src/zh/UserGuide/latest/SQL-Manual/SQL-Manual_timecho.md
b/src/zh/UserGuide/latest/SQL-Manual/SQL-Manual_timecho.md
index f2f82df1..deb356f6 100644
--- a/src/zh/UserGuide/latest/SQL-Manual/SQL-Manual_timecho.md
+++ b/src/zh/UserGuide/latest/SQL-Manual/SQL-Manual_timecho.md
@@ -72,8 +72,14 @@ create timeseries root.ln.wf02.wt02.status WITH
DATATYPE=BOOLEAN;
CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(latitude FLOAT, longitude FLOAT);
```
-#### 修改时间序列名称
+#### 修改时间序列数据类型
+> V2.0.8 起支持该语句
+
+```sql
+ALTER TIMESERIES root.ln.wf01.wt01.temperature set data type DOUBLE
+```
+#### 修改时间序列名称
> V2.0.8 起支持该语句
```SQL