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 7e2e628ac..7fc142d3d 100644 --- a/src/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md +++ b/src/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md @@ -302,7 +302,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) and configuring table properties. **Syntax:** @@ -313,6 +313,7 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN (IF NOT EXISTS)? col | ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES propertyAssignments #setTableProperties | COMMENT ON TABLE tableName=qualifiedName IS 'table_comment' | COMMENT ON COLUMN tableName.column IS 'column_comment' +| ALTER TABLE (IF EXISTS)? tableName=qualifiedName ALTER COLUMN (IF EXISTS)? column=identifier SET DATA TYPE new_type=type #changeColumndatatype ``` **Note::** @@ -320,6 +321,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, 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:** @@ -329,6 +334,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 5c68a9b43..ba1d193f9 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 @@ -310,6 +310,7 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN (IF NOT EXISTS)? col | ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES propertyAssignments #setTableProperties | COMMENT ON TABLE tableName=qualifiedName IS 'table_comment' | COMMENT ON COLUMN tableName.column IS 'column_comment' +| ALTER TABLE (IF EXISTS)? tableName=qualifiedName ALTER COLUMN (IF EXISTS)? column=identifier SET DATA TYPE new_type=type #changeColumndatatype ``` **Examples:** @@ -320,6 +321,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 7e047e97e..880bf5c57 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 @@ -141,7 +141,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 @@ -156,6 +156,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 @@ -171,6 +174,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 @@ -183,6 +201,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 5bc7d549b..c509538a4 100644 --- a/src/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_timecho.md +++ b/src/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_timecho.md @@ -409,7 +409,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 Delete Timeseries +### 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 Delete Timeseries To delete the timeseries we created before, we are able to use `(DELETE | DROP) TimeSeries ` statement. @@ -422,7 +458,7 @@ IoTDB> delete timeseries root.ln.wf02.* IoTDB> drop timeseries root.ln.wf02.* ``` -### 2.4 Show Timeseries +### 2.5 Show Timeseries * SHOW LATEST? TIMESERIES pathPattern? whereClause? limitClause? @@ -566,7 +602,7 @@ It costs 0.004s It is worth noting that when the queried path does not exist, the system will return no timeseries. -### 2.5 Count Timeseries +### 2.6 Count Timeseries IoTDB is able to use `COUNT TIMESERIES ` to count the number of timeseries matching the path. SQL statements are as follows: @@ -651,7 +687,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.6 Active Timeseries Query +### 2.7 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. @@ -691,7 +727,7 @@ IoTDB> 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.7 Tag and Attribute Management +### 2.8 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 b3a2f00b9..92164bb87 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 07363f7c6..2dcea25bf 100644 --- a/src/UserGuide/Master/Tree/SQL-Manual/SQL-Manual_timecho.md +++ b/src/UserGuide/Master/Tree/SQL-Manual/SQL-Manual_timecho.md @@ -142,7 +142,16 @@ error: encoding TS_2DIFF does not support BOOLEAN IoTDB> CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(latitude FLOAT , longitude FLOAT) ``` -### 2.3 Delete Timeseries +### 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 Delete Timeseries ```sql IoTDB> delete timeseries root.ln.wf01.wt01.status @@ -151,7 +160,7 @@ IoTDB> delete timeseries root.ln.wf02.* IoTDB> drop timeseries root.ln.wf02.* ``` -### 2.4 Show Timeseries +### 2.5 Show Timeseries ```sql IoTDB> show timeseries root.** @@ -161,7 +170,7 @@ IoTDB> show timeseries root.ln.** where timeseries contains 'wf01.wt' IoTDB> show timeseries root.ln.** where dataType=FLOAT ``` -### 2.5 Count Timeseries +### 2.6 Count Timeseries ```sql IoTDB > COUNT TIMESERIES root.** @@ -178,7 +187,7 @@ IoTDB > COUNT TIMESERIES root.ln.** GROUP BY LEVEL=2 IoTDB > COUNT TIMESERIES root.ln.wf01.* GROUP BY LEVEL=2 ``` -### 2.6 Tag and Attribute Management +### 2.7 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 7e2e628ac..7fc142d3d 100644 --- a/src/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md +++ b/src/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md @@ -302,7 +302,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) and configuring table properties. **Syntax:** @@ -313,6 +313,7 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN (IF NOT EXISTS)? col | ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES propertyAssignments #setTableProperties | COMMENT ON TABLE tableName=qualifiedName IS 'table_comment' | COMMENT ON COLUMN tableName.column IS 'column_comment' +| ALTER TABLE (IF EXISTS)? tableName=qualifiedName ALTER COLUMN (IF EXISTS)? column=identifier SET DATA TYPE new_type=type #changeColumndatatype ``` **Note::** @@ -320,6 +321,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, 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:** @@ -329,6 +334,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 5c68a9b43..ba1d193f9 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 @@ -310,6 +310,7 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN (IF NOT EXISTS)? col | ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES propertyAssignments #setTableProperties | COMMENT ON TABLE tableName=qualifiedName IS 'table_comment' | COMMENT ON COLUMN tableName.column IS 'column_comment' +| ALTER TABLE (IF EXISTS)? tableName=qualifiedName ALTER COLUMN (IF EXISTS)? column=identifier SET DATA TYPE new_type=type #changeColumndatatype ``` **Examples:** @@ -320,6 +321,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 7e047e97e..880bf5c57 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 @@ -141,7 +141,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 @@ -156,6 +156,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 @@ -171,6 +174,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 @@ -183,6 +201,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 5bc7d549b..c509538a4 100644 --- a/src/UserGuide/latest/Basic-Concept/Operate-Metadata_timecho.md +++ b/src/UserGuide/latest/Basic-Concept/Operate-Metadata_timecho.md @@ -409,7 +409,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 Delete Timeseries +### 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 Delete Timeseries To delete the timeseries we created before, we are able to use `(DELETE | DROP) TimeSeries ` statement. @@ -422,7 +458,7 @@ IoTDB> delete timeseries root.ln.wf02.* IoTDB> drop timeseries root.ln.wf02.* ``` -### 2.4 Show Timeseries +### 2.5 Show Timeseries * SHOW LATEST? TIMESERIES pathPattern? whereClause? limitClause? @@ -566,7 +602,7 @@ It costs 0.004s It is worth noting that when the queried path does not exist, the system will return no timeseries. -### 2.5 Count Timeseries +### 2.6 Count Timeseries IoTDB is able to use `COUNT TIMESERIES ` to count the number of timeseries matching the path. SQL statements are as follows: @@ -651,7 +687,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.6 Active Timeseries Query +### 2.7 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. @@ -691,7 +727,7 @@ IoTDB> 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.7 Tag and Attribute Management +### 2.8 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 b3a2f00b9..92164bb87 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 07363f7c6..2dcea25bf 100644 --- a/src/UserGuide/latest/SQL-Manual/SQL-Manual_timecho.md +++ b/src/UserGuide/latest/SQL-Manual/SQL-Manual_timecho.md @@ -142,7 +142,16 @@ error: encoding TS_2DIFF does not support BOOLEAN IoTDB> CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(latitude FLOAT , longitude FLOAT) ``` -### 2.3 Delete Timeseries +### 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 Delete Timeseries ```sql IoTDB> delete timeseries root.ln.wf01.wt01.status @@ -151,7 +160,7 @@ IoTDB> delete timeseries root.ln.wf02.* IoTDB> drop timeseries root.ln.wf02.* ``` -### 2.4 Show Timeseries +### 2.5 Show Timeseries ```sql IoTDB> show timeseries root.** @@ -161,7 +170,7 @@ IoTDB> show timeseries root.ln.** where timeseries contains 'wf01.wt' IoTDB> show timeseries root.ln.** where dataType=FLOAT ``` -### 2.5 Count Timeseries +### 2.6 Count Timeseries ```sql IoTDB > COUNT TIMESERIES root.** @@ -178,7 +187,7 @@ IoTDB > COUNT TIMESERIES root.ln.** GROUP BY LEVEL=2 IoTDB > COUNT TIMESERIES root.ln.wf01.* GROUP BY LEVEL=2 ``` -### 2.6 Tag and Attribute Management +### 2.7 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 ed4b890a8..c239c18c2 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 @@ -309,7 +309,7 @@ Total line number = 1 ### 1.5 修改表 -用于修改表,包括添加列、删除列以及设置表的属性。 +用于修改表,包括添加列、删除列、修改列类型(V2.0.8)以及设置表的属性。 **语法:** @@ -320,6 +320,7 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN (IF NOT EXISTS)? col | ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES propertyAssignments #setTableProperties | COMMENT ON TABLE tableName=qualifiedName IS 'table_comment' | COMMENT ON COLUMN tableName.column IS 'column_comment' +| ALTER TABLE (IF EXISTS)? tableName=qualifiedName ALTER COLUMN (IF EXISTS)? column=identifier SET DATA TYPE new_type=type #changeColumndatatype ``` **说明:** @@ -327,6 +328,23 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN (IF NOT EXISTS)? col 1. `SET PROPERTIES`操作目前仅支持对表的 TTL 属性进行配置。 2. 删除列功能,仅支持删除属性列(ATTRIBUTE)和物理量列(FIELD),标识列(TAG)不支持删除。 3. 修改后的 comment 会覆盖原有注释,如果指定为 null,则会擦除之前的 comment。 +4. 自 V2.0.8 版本起支持修改字段数据类型,目前只支持修改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 | + **示例:** @@ -336,6 +354,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 27e7c1b7a..ad8ed86a4 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 @@ -307,6 +307,7 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN (IF NOT EXISTS)? col | ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES propertyAssignments #setTableProperties | COMMENT ON TABLE tableName=qualifiedName IS 'table_comment' | COMMENT ON COLUMN tableName.column IS 'column_comment' +| ALTER TABLE (IF EXISTS)? tableName=qualifiedName ALTER COLUMN (IF EXISTS)? column=identifier SET DATA TYPE new_type=type #changeColumndatatype ``` **示例:** @@ -317,6 +318,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 d3a0a6223..8960c2914 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 @@ -138,7 +138,7 @@ AS root.db.** ### 2.2 修改表视图 #### 2.2.1 语法定义 -修改表视图功能支持修改视图名称、添加列、列重命名、删除列、设置视图的 TTL 属性,以及通过 COMMENT 添加注释。 +修改表视图功能支持修改视图名称、添加列、列重命名、修改 FIELD 列数据类型(V2.0.8 起支持)、删除列、设置视图的 TTL 属性,以及通过 COMMENT 添加注释。 ```SQL -- 修改视图名 @@ -153,6 +153,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 @@ -168,6 +171,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 @@ -180,6 +198,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 529aab548..7d75860c7 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 @@ -397,7 +397,43 @@ IoTDB> CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(latitude FLOAT, longitude FLOA 对齐的时间序列也支持设置别名、标签、属性。 -### 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 删除时间序列 我们可以使用`(DELETE | DROP) TimeSeries `语句来删除我们之前创建的时间序列。SQL 语句如下所示: @@ -408,7 +444,7 @@ IoTDB> delete timeseries root.ln.wf02.* IoTDB> drop timeseries root.ln.wf02.* ``` -### 2.4 查看时间序列 +### 2.5 查看时间序列 * SHOW LATEST? TIMESERIES pathPattern? timeseriesWhereClause? limitClause? @@ -552,7 +588,7 @@ It costs 0.004s 需要注意的是,当查询路径不存在时,系统会返回 0 条时间序列。 -### 2.5 统计时间序列总数 +### 2.6 统计时间序列总数 IoTDB 支持使用`COUNT TIMESERIES`来统计一条路径中的时间序列个数。SQL 语句如下所示: @@ -639,7 +675,7 @@ It costs 0.002s > 注意:时间序列的路径只是过滤条件,与 level 的定义无关。 -### 2.6 活跃时间序列查询 +### 2.7 活跃时间序列查询 我们在原有的时间序列查询和统计上添加新的WHERE时间过滤条件,可以得到在指定时间范围中存在数据的时间序列。 需要注意的是, 在带有时间过滤的元数据查询中并不考虑视图的存在,只考虑TsFile中实际存储的时间序列。 @@ -680,7 +716,7 @@ IoTDB> count timeseries where time >= 15000 and time < 16000; ``` 关于活跃时间序列的定义,能通过正常查询查出来的数据就是活跃数据,也就是说插入但被删除的时间序列不在考虑范围内。 -### 2.7 标签点管理 +### 2.8 标签点管理 我们可以在创建时间序列的时候,为它添加别名和额外的标签和属性信息。 diff --git a/src/zh/UserGuide/Master/Tree/SQL-Manual/Keywords.md b/src/zh/UserGuide/Master/Tree/SQL-Manual/Keywords.md index 4064b94c3..9aa3ced7f 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 55083e822..dcf0346c4 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,6 +72,13 @@ 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 +``` + #### 删除时间序列 ```sql @@ -1537,7 +1544,7 @@ SHOW TRIGGERS ### 12.1 语法 -```sql +```Go CREATE (CONTINUOUS QUERY | CQ) [RESAMPLE [EVERY ] 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 ed4b890a8..c239c18c2 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 @@ -309,7 +309,7 @@ Total line number = 1 ### 1.5 修改表 -用于修改表,包括添加列、删除列以及设置表的属性。 +用于修改表,包括添加列、删除列、修改列类型(V2.0.8)以及设置表的属性。 **语法:** @@ -320,6 +320,7 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN (IF NOT EXISTS)? col | ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES propertyAssignments #setTableProperties | COMMENT ON TABLE tableName=qualifiedName IS 'table_comment' | COMMENT ON COLUMN tableName.column IS 'column_comment' +| ALTER TABLE (IF EXISTS)? tableName=qualifiedName ALTER COLUMN (IF EXISTS)? column=identifier SET DATA TYPE new_type=type #changeColumndatatype ``` **说明:** @@ -327,6 +328,23 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN (IF NOT EXISTS)? col 1. `SET PROPERTIES`操作目前仅支持对表的 TTL 属性进行配置。 2. 删除列功能,仅支持删除属性列(ATTRIBUTE)和物理量列(FIELD),标识列(TAG)不支持删除。 3. 修改后的 comment 会覆盖原有注释,如果指定为 null,则会擦除之前的 comment。 +4. 自 V2.0.8 版本起支持修改字段数据类型,目前只支持修改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 | + **示例:** @@ -336,6 +354,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 27e7c1b7a..ad8ed86a4 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 @@ -307,6 +307,7 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN (IF NOT EXISTS)? col | ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES propertyAssignments #setTableProperties | COMMENT ON TABLE tableName=qualifiedName IS 'table_comment' | COMMENT ON COLUMN tableName.column IS 'column_comment' +| ALTER TABLE (IF EXISTS)? tableName=qualifiedName ALTER COLUMN (IF EXISTS)? column=identifier SET DATA TYPE new_type=type #changeColumndatatype ``` **示例:** @@ -317,6 +318,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 d3a0a6223..8960c2914 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 @@ -138,7 +138,7 @@ AS root.db.** ### 2.2 修改表视图 #### 2.2.1 语法定义 -修改表视图功能支持修改视图名称、添加列、列重命名、删除列、设置视图的 TTL 属性,以及通过 COMMENT 添加注释。 +修改表视图功能支持修改视图名称、添加列、列重命名、修改 FIELD 列数据类型(V2.0.8 起支持)、删除列、设置视图的 TTL 属性,以及通过 COMMENT 添加注释。 ```SQL -- 修改视图名 @@ -153,6 +153,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 @@ -168,6 +171,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 @@ -180,6 +198,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 529aab548..7d75860c7 100644 --- a/src/zh/UserGuide/latest/Basic-Concept/Operate-Metadata_timecho.md +++ b/src/zh/UserGuide/latest/Basic-Concept/Operate-Metadata_timecho.md @@ -397,7 +397,43 @@ IoTDB> CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(latitude FLOAT, longitude FLOA 对齐的时间序列也支持设置别名、标签、属性。 -### 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 删除时间序列 我们可以使用`(DELETE | DROP) TimeSeries `语句来删除我们之前创建的时间序列。SQL 语句如下所示: @@ -408,7 +444,7 @@ IoTDB> delete timeseries root.ln.wf02.* IoTDB> drop timeseries root.ln.wf02.* ``` -### 2.4 查看时间序列 +### 2.5 查看时间序列 * SHOW LATEST? TIMESERIES pathPattern? timeseriesWhereClause? limitClause? @@ -552,7 +588,7 @@ It costs 0.004s 需要注意的是,当查询路径不存在时,系统会返回 0 条时间序列。 -### 2.5 统计时间序列总数 +### 2.6 统计时间序列总数 IoTDB 支持使用`COUNT TIMESERIES`来统计一条路径中的时间序列个数。SQL 语句如下所示: @@ -639,7 +675,7 @@ It costs 0.002s > 注意:时间序列的路径只是过滤条件,与 level 的定义无关。 -### 2.6 活跃时间序列查询 +### 2.7 活跃时间序列查询 我们在原有的时间序列查询和统计上添加新的WHERE时间过滤条件,可以得到在指定时间范围中存在数据的时间序列。 需要注意的是, 在带有时间过滤的元数据查询中并不考虑视图的存在,只考虑TsFile中实际存储的时间序列。 @@ -680,7 +716,7 @@ IoTDB> count timeseries where time >= 15000 and time < 16000; ``` 关于活跃时间序列的定义,能通过正常查询查出来的数据就是活跃数据,也就是说插入但被删除的时间序列不在考虑范围内。 -### 2.7 标签点管理 +### 2.8 标签点管理 我们可以在创建时间序列的时候,为它添加别名和额外的标签和属性信息。 diff --git a/src/zh/UserGuide/latest/SQL-Manual/Keywords.md b/src/zh/UserGuide/latest/SQL-Manual/Keywords.md index 4064b94c3..9aa3ced7f 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 256e2794d..dcf0346c4 100644 --- a/src/zh/UserGuide/latest/SQL-Manual/SQL-Manual_timecho.md +++ b/src/zh/UserGuide/latest/SQL-Manual/SQL-Manual_timecho.md @@ -72,6 +72,13 @@ 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 +``` + #### 删除时间序列 ```sql