This is an automated email from the ASF dual-hosted git repository. haonan pushed a commit to branch Updatetz in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 764c366aa2a4d84dbc02bd47da03f40a2c95b348 Author: HTHou <[email protected]> AuthorDate: Wed Sep 1 10:42:12 2021 +0800 Update some time zone usage document in CLI --- README.md | 86 ++++++++++++++++++++++++-------------- README_ZH.md | 86 ++++++++++++++++++++++++-------------- docs/UserGuide/API/Time-zone.md | 6 +++ docs/zh/UserGuide/API/Time-zone.md | 8 +++- 4 files changed, 121 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index 0522e5b..76e26af 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ This short guide will walk you through the basic process of using IoTDB. For a m To use IoTDB, you need to have: -1. Java >= 1.8 (1.8, 11, and 15 are verified. Please make sure the environment path has been set accordingly). +1. Java >= 1.8 (1.8, 11, and 16 are verified. Please make sure the environment path has been set accordingly). 2. Maven >= 3.6 (If you want to compile and install IoTDB from source code). 3. Set the max open files num as 65535 to avoid "too many open files" error. @@ -250,12 +250,12 @@ We can also use SHOW STORAGE GROUP to check the storage group being created: ``` IoTDB> SHOW STORAGE GROUP -+-----------------------------------+ -| Storage Group| -+-----------------------------------+ -| root.ln| -+-----------------------------------+ -storage group number = 1 ++-------------+ +|storage group| ++-------------+ +| root.ln| ++-------------+ +Total line number = 1 ``` After the storage group is set, we can use CREATE TIMESERIES to create a new timeseries. When creating a timeseries, we should define its data type and the encoding scheme. Here We create two timeseries: @@ -271,25 +271,25 @@ In order to query the specific timeseries, we can use SHOW TIMESERIES <Path>. <P ``` IoTDB> SHOW TIMESERIES -+-------------------------------+------+-------------+--------+--------+-----------+----+----------+ -| timeseries | alias|storage group|dataType|encoding|compression|tags|attributes| -+-------------------------------+------+-------------+--------+--------+-----------+----+----------+ -| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| PLAIN| SNAPPY|null| null| -| root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| RLE| SNAPPY|null| null| -+-------------------------------+------+-------------+--------+--------+-----------+----+----------+ -Total timeseries number = 2 ++-----------------------------+-----+-------------+--------+--------+-----------+----+----------+ +| timeseries|alias|storage group|dataType|encoding|compression|tags|attributes| ++-----------------------------+-----+-------------+--------+--------+-----------+----+----------+ +|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| RLE| SNAPPY|null| null| +| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| PLAIN| SNAPPY|null| null| ++-----------------------------+-----+-------------+--------+--------+-----------+----+----------+ +Total line number = 2 ``` 2. Querying a specific timeseries(root.ln.wf01.wt01.status): ``` IoTDB> SHOW TIMESERIES root.ln.wf01.wt01.status -+-------------------------------+------+-------------+--------+--------+-----------+----+----------+ -| timeseries | alias|storage group|dataType|encoding|compression|tags|attributes| -+-------------------------------+------+-------------+--------+--------+-----------+----+----------+ -| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| PLAIN| SNAPPY|null| null| -+-------------------------------+------+-------------+--------+--------+-----------+----+----------+ -Total timeseries number = 1 ++------------------------+-----+-------------+--------+--------+-----------+----+----------+ +| timeseries|alias|storage group|dataType|encoding|compression|tags|attributes| ++------------------------+-----+-------------+--------+--------+-----------+----+----------+ +|root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| PLAIN| SNAPPY|null| null| ++------------------------+-----+-------------+--------+--------+-----------+----+----------+ +Total line number = 1 ``` Insert timeseries data is a basic operation of IoTDB, you can use ‘INSERT’ command to finish this. Before insertion, you should assign the timestamp and the suffix path name: @@ -303,12 +303,12 @@ The data that you have just inserted will display as follows: ``` IoTDB> SELECT status FROM root.ln.wf01.wt01 -+-----------------------+------------------------+ -| Time|root.ln.wf01.wt01.status| -+-----------------------+------------------------+ -|1970-01-01T08:00:00.100| true| -|1970-01-01T08:00:00.200| false| -+-----------------------+------------------------+ ++------------------------+------------------------+ +| Time|root.ln.wf01.wt01.status| ++------------------------+------------------------+ +|1970-01-01T00:00:00.100Z| true| +|1970-01-01T00:00:00.200Z| false| ++------------------------+------------------------+ Total line number = 2 ``` @@ -316,12 +316,34 @@ You can also query several timeseries data using one SQL statement: ``` IoTDB> SELECT * FROM root.ln.wf01.wt01 -+-----------------------+--------------------------+-----------------------------+ -| Time| root.ln.wf01.wt01.status|root.ln.wf01.wt01.temperature| -+-----------------------+--------------------------+-----------------------------+ -|1970-01-01T08:00:00.100| true| null| -|1970-01-01T08:00:00.200| false| 20.71| -+-----------------------+--------------------------+-----------------------------+ ++------------------------+-----------------------------+------------------------+ +| Time|root.ln.wf01.wt01.temperature|root.ln.wf01.wt01.status| ++------------------------+-----------------------------+------------------------+ +|1970-01-01T00:00:00.100Z| null| true| +|1970-01-01T00:00:00.200Z| 20.71| false| ++------------------------+-----------------------------+------------------------+ +Total line number = 2 +``` + +To change the time zone in Cli, you can use the following SQL: + +``` +IoTDB> SET time_zone=+08:00 +Time zone has set to +08:00 +IoTDB> SHOW time_zone +Current time zone: Asia/Shanghai +``` + +Add then the query result will show using the new time zone. + +``` +IoTDB> SELECT * FROM root.ln.wf01.wt01 ++-----------------------------+-----------------------------+------------------------+ +| Time|root.ln.wf01.wt01.temperature|root.ln.wf01.wt01.status| ++-----------------------------+-----------------------------+------------------------+ +|1970-01-01T08:00:00.100+08:00| null| true| +|1970-01-01T08:00:00.200+08:00| 20.71| false| ++-----------------------------+-----------------------------+------------------------+ Total line number = 2 ``` diff --git a/README_ZH.md b/README_ZH.md index e40822a..e01927f 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -84,7 +84,7 @@ IoTDB的主要特点如下: ## 环境准备 要使用IoTDB,您需要: -1. Java >= 1.8 (目前 1.8、11和15 已经被验证可用。请确保环变量境路径已正确设置)。 +1. Java >= 1.8 (目前 1.8、11和16 已经被验证可用。请确保环变量境路径已正确设置)。 2. Maven >= 3.6 (如果希望从源代码编译和安装IoTDB)。 3. 设置 max open files 为 65535,以避免"too many open files"错误。 @@ -236,12 +236,12 @@ IoTDB> SET STORAGE GROUP TO root.ln ``` IoTDB> SHOW STORAGE GROUP -+-----------------------------------+ -| Storage Group| -+-----------------------------------+ -| root.ln| -+-----------------------------------+ -storage group number = 1 ++-------------+ +|storage group| ++-------------+ +| root.ln| ++-------------+ +Total line number = 1 ``` 在设置存储组之后,我们可以使用CREATE TIMESERIES来创建一个新的TIMESERIES。 @@ -260,25 +260,25 @@ IoTDB> CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCO ``` IoTDB> SHOW TIMESERIES -+-------------------------------+------+-------------+--------+--------+-----------+----+----------+ -| timeseries | alias|storage group|dataType|encoding|compression|tags|attributes| -+-------------------------------+------+-------------+--------+--------+-----------+----+----------+ -| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| PLAIN| SNAPPY|null| null| -| root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| RLE| SNAPPY|null| null| -+-------------------------------+------+-------------+--------+--------+-----------+----+----------+ -Total timeseries number = 2 ++-----------------------------+-----+-------------+--------+--------+-----------+----+----------+ +| timeseries|alias|storage group|dataType|encoding|compression|tags|attributes| ++-----------------------------+-----+-------------+--------+--------+-----------+----+----------+ +|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| RLE| SNAPPY|null| null| +| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| PLAIN| SNAPPY|null| null| ++-----------------------------+-----+-------------+--------+--------+-----------+----+----------+ +Total line number = 2 ``` 2. 查询指定的 timeseries(root.ln.wf01.wt01.status): ``` IoTDB> SHOW TIMESERIES root.ln.wf01.wt01.status -+-------------------------------+------+-------------+--------+--------+-----------+----+----------+ -| timeseries | alias|storage group|dataType|encoding|compression|tags|attributes| -+-------------------------------+------+-------------+--------+--------+-----------+----+----------+ -| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| PLAIN| SNAPPY|null| null| -+-------------------------------+------+-------------+--------+--------+-----------+----+----------+ -Total timeseries number = 1 ++------------------------+-----+-------------+--------+--------+-----------+----+----------+ +| timeseries|alias|storage group|dataType|encoding|compression|tags|attributes| ++------------------------+-----+-------------+--------+--------+-----------+----+----------+ +|root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| PLAIN| SNAPPY|null| null| ++------------------------+-----+-------------+--------+--------+-----------+----+----------+ +Total line number = 1 ``` 插入 timeseries 数据是IoTDB的一个基本操作,你可以使用`INSERT` 命令来完成这个操作。 @@ -293,12 +293,12 @@ IoTDB> INSERT INTO root.ln.wf01.wt01(timestamp,status,temperature) values(200,fa ``` IoTDB> SELECT status FROM root.ln.wf01.wt01 -+-----------------------+------------------------+ -| Time|root.ln.wf01.wt01.status| -+-----------------------+------------------------+ -|1970-01-01T08:00:00.100| true| -|1970-01-01T08:00:00.200| false| -+-----------------------+------------------------+ ++-----------------------------+------------------------+ +| Time|root.ln.wf01.wt01.status| ++-----------------------------+------------------------+ +|1970-01-01T08:00:00.100+08:00| true| +|1970-01-01T08:00:00.200+08:00| false| ++-----------------------------+------------------------+ Total line number = 2 ``` @@ -306,12 +306,34 @@ Total line number = 2 ``` IoTDB> SELECT * FROM root.ln.wf01.wt01 -+-----------------------+--------------------------+-----------------------------+ -| Time| root.ln.wf01.wt01.status|root.ln.wf01.wt01.temperature| -+-----------------------+--------------------------+-----------------------------+ -|1970-01-01T08:00:00.100| true| null| -|1970-01-01T08:00:00.200| false| 20.71| -+-----------------------+--------------------------+-----------------------------+ ++-----------------------------+-----------------------------+------------------------+ +| Time|root.ln.wf01.wt01.temperature|root.ln.wf01.wt01.status| ++-----------------------------+-----------------------------+------------------------+ +|1970-01-01T08:00:00.100+08:00| null| true| +|1970-01-01T08:00:00.200+08:00| 20.71| false| ++-----------------------------+-----------------------------+------------------------+ +Total line number = 2 +``` + +如果需要修改 Cli 中的时区,您可以使用以下语句: + +``` +IoTDB> SET time_zone=+00:00 +Time zone has set to +00:00 +IoTDB> SHOW time_zone +Current time zone: Z +``` + +之后查询结果将会以更新后的新时区显示: + +``` +IoTDB> SELECT * FROM root.ln.wf01.wt01 ++------------------------+-----------------------------+------------------------+ +| Time|root.ln.wf01.wt01.temperature|root.ln.wf01.wt01.status| ++------------------------+-----------------------------+------------------------+ +|1970-01-01T00:00:00.100Z| null| true| +|1970-01-01T00:00:00.200Z| 20.71| false| ++------------------------+-----------------------------+------------------------+ Total line number = 2 ``` diff --git a/docs/UserGuide/API/Time-zone.md b/docs/UserGuide/API/Time-zone.md index 40bf945..76f9c43 100644 --- a/docs/UserGuide/API/Time-zone.md +++ b/docs/UserGuide/API/Time-zone.md @@ -45,6 +45,12 @@ JDBC: (IoTDBConnection) connection.getTimeZone(); Session: session.getTimeZone(); ``` +In CLI: + +```sql +SHOW time_zone +``` + ## Time zone usage scenarios The IoTDB server only stores and processes time stamps, and the time zone is only used to interact with clients. The specific scenarios are as follows: diff --git a/docs/zh/UserGuide/API/Time-zone.md b/docs/zh/UserGuide/API/Time-zone.md index 3c4a098..097db2a 100644 --- a/docs/zh/UserGuide/API/Time-zone.md +++ b/docs/zh/UserGuide/API/Time-zone.md @@ -33,7 +33,7 @@ Session: session.setTimeZone("+08:00"); 在 CLI 命令行工具中,通过 SQL 手动设置时区的方式为: -```java +```sql SET time_zone=+08:00 ``` @@ -45,6 +45,12 @@ JDBC: (IoTDBConnection) connection.getTimeZone(); Session: session.getTimeZone(); ``` +CLI 中的方法为: + +```sql +SHOW time_zone +``` + ## 时区使用场景 IoTDB 服务器只针对时间戳进行存储和处理,时区只用来与客户端进行交互,具体场景如下:
