You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/04/02 10:08:29 UTC
[incubator-iotdb] 01/01: update last doc
This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch modify_last_doc
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
commit 3c3dbe4953131484adf474327b3dc5d9bffb5f69
Author: qiaojialin <64...@qq.com>
AuthorDate: Thu Apr 2 18:09:03 2020 +0800
update last doc
---
.../2-DML Data Manipulation Language.md | 34 +++++++++++++---------
.../2-DML Data Manipulation Language.md | 27 ++++++++++-------
2 files changed, 37 insertions(+), 24 deletions(-)
diff --git a/docs/UserGuide/5-Operation Manual/2-DML Data Manipulation Language.md b/docs/UserGuide/5-Operation Manual/2-DML Data Manipulation Language.md
index 50ea02d..5f15354 100644
--- a/docs/UserGuide/5-Operation Manual/2-DML Data Manipulation Language.md
+++ b/docs/UserGuide/5-Operation Manual/2-DML Data Manipulation Language.md
@@ -244,36 +244,44 @@ The path after SELECT in GROUP BY statement must be aggregate function, otherwis
<center><img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/16079446/69116099-0b715300-0ac6-11ea-8074-84e04797b8c7.png"></center>
-### Last timestamp Query
-In scenarios when IoT devices updates data in a fast manner, users are more interested in the most recent record of IoT devices.
-The LAST query is to return the most recent value of the given timeseries in a time-value pair format.
+### Last point Query
-The SQL statement is:
+In scenarios when IoT devices updates data in a fast manner, users are more interested in the most recent point of IoT devices.
+
+The Last point query is to return the most recent data point of the given timeseries in a three column format.
+
+The SQL statement is defined as:
```
select last <Path> [COMMA <Path>]* from < PrefixPath > [COMMA < PrefixPath >]* <DISABLE ALIGN>
```
-which means:
-Query and return the data with the largest timestamp of timeseries prefixPath.path.
+which means: Query and return the last data points of timeseries prefixPath.path.
+
+The result will be returned in a three column table format.
-In the following example, we queries the latest record of timeseries root.ln.wf01.wt01.status:
```
-select last status from root.ln.wf01.wt01 disable align
+| Time | Path | Value |
```
-The result will be returned in a three column table format.
+
+Example 1: get the last point of root.ln.wf01.wt01.speed:
+
```
+> select last speed from root.ln.wf01.wt01
+
| Time | Path | Value |
| --- | ----------------------- | ----- |
-| 5 | root.ln.wf01.wt01.status| 100 |
+| 5 | root.ln.wf01.wt01.speed | 100 |
```
-If the path root.ln.wf01.wt01 has multiple columns, for example id, status and temperature, the following case will return records of all the three measurements with the largest timestamp.
+
+Example 2: get the last speed, status and temperature points of root.ln.wf01.wt01
+
```
-select last id, status, temperature from root.ln.wf01.wt01 disable align
+> select last speed, status, temperature from root.ln.wf01.wt01
| Time | Path | Value |
| --- | ---------------------------- | ----- |
-| 5 | root.ln.wf01.wt01.id | 10 |
+| 5 | root.ln.wf01.wt01.speed | 100 |
| 7 | root.ln.wf01.wt01.status | true |
| 9 | root.ln.wf01.wt01.temperature| 35.7 |
```
diff --git a/docs/zh/UserGuide/5-Operation Manual/2-DML Data Manipulation Language.md b/docs/zh/UserGuide/5-Operation Manual/2-DML Data Manipulation Language.md
index dc4e97e..f281ab2 100644
--- a/docs/zh/UserGuide/5-Operation Manual/2-DML Data Manipulation Language.md
+++ b/docs/zh/UserGuide/5-Operation Manual/2-DML Data Manipulation Language.md
@@ -273,35 +273,40 @@ GROUP BY的SELECT子句里的查询路径必须是聚合函数,否则系统将
<center><img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/16079446/69116099-0b715300-0ac6-11ea-8074-84e04797b8c7.png"></center>
-### 最近时间戳数据查询
+### 最新数据查询
-对应的SQL语句是:
+SQL语法:
```
select last <Path> [COMMA <Path>]* from < PrefixPath > [COMMA < PrefixPath >]* <DISABLE ALIGN>
```
-其含义是:
-查询时间序列prefixPath.path中最近时间戳的数据
+其含义是:查询时间序列prefixPath.path中最近时间戳的数据
+
+结果集为三列的结构
-下面的例子中查询时间序列root.ln.wf01.wt01.status最近时间戳的数据:
```
-select last status from root.ln.wf01.wt01 disable align
+| Time | Path | Value |
```
-结果集为以下的形式返回:
+
+示例 1:查询 root.ln.wf01.wt01.speed 的最新数据点
+
```
+> select last status from root.ln.wf01.wt01
+
| Time | Path | Value |
| --- | ----------------------- | ----- |
-| 5 | root.ln.wf01.wt01.status| 100 |
+| 5 | root.ln.wf01.wt01.speed | 100 |
```
-假设root.ln.wf01.wt01中包含多列数据,如id, status, temperature,下面的例子将会把这几列数据在最近时间戳的记录同时返回:
+示例 2:查询 root.ln.wf01.wt01 下 speed,status,temperature 的最新数据点
+
```
-select last id, status, temperature from root.ln.wf01 disable align
+> select last speed, status, temperature from root.ln.wf01
| Time | Path | Value |
| --- | ---------------------------- | ----- |
-| 5 | root.ln.wf01.wt01.id | 10 |
+| 5 | root.ln.wf01.wt01.speed | 100 |
| 7 | root.ln.wf01.wt01.status | true |
| 9 | root.ln.wf01.wt01.temperature| 35.7 |
```