Skip to content

Commit

Permalink
Fix As clause doc (apache#1697)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alima777 authored and eileenghm committed Sep 21, 2020
1 parent 19452dc commit 1b38995
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,12 @@ create timeseries root.turbine.d1.s1(temprature) with datatype=FLOAT, encoding=R

The `temprature` in the brackets is an alias for the sensor `s1`. So we can use `temprature` to replace `s1` anywhere.

> Notice that the size of the extra tag and attribute information shouldn't exceed the `tag_attribute_total_size`.
> IoTDB also supports [using AS function](../Operation%20Manual/DML%20Data%20Manipulation%20Language.md) to set alias. The difference between the two is: the alias set by the AS function is used to replace the whole time series name, temporary and not bound with the time series; while the alias mentioned above is only used as the alias of the sensor, which is bound with it and can be used equivalent to the original sensor name.
The only difference between tag and attribute is that we will maintain an inverted index on the tag, so we can use tag property in the show timeseries where clause which you can see in the following `Show Timeseries` section.

> Notice that the size of the extra tag and attribute information shouldn't exceed the `tag_attribute_total_size`.

## UPDATE TAG OPERATION
We can update the tag information after creating it as following:
Expand Down
4 changes: 2 additions & 2 deletions docs/UserGuide/Operation Manual/SQL Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ For example, "select last s1, s2 from root.sg.d1, root.sg.d2", the query result
As statement assigns an alias to time seires queried in SELECT statement

```
You can use as statement in all query type.
You can use as statement in all queries, but some rules are restricted about wildcard.
1. Raw data query
select s1 as speed, s2 as temperature from root.sg.d1
Expand All @@ -639,7 +639,7 @@ select s1 as speed, s2 as temperature from root.sg.d1 align by device
select count(s1) as s1_num, count(s2), count(s3) as s3_num from root.sg.d2 align by device
5. Last query
5. Last Record query
select last s1 as speed, s2 from root.sg.d1
Rules:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ create timeseries root.turbine.d1.s1(temprature) with datatype=FLOAT, encoding=R
括号里的`temprature``s1`这个传感器的别名。
我们可以在任何用到`s1`的地方,将其用`temprature`代替,这两者是等价的。

> 注意:额外的标签和属性信息总的大小不能超过`tag_attribute_total_size`.
> IoTDB 同时支持在查询语句中[使用AS函数](../Operation%20Manual/DML%20Data%20Manipulation%20Language.md)设置别名。二者的区别在于:AS 函数设置的别名用于替代整条时间序列名,且是临时的,不与时间序列绑定;而上文中的别名只作为传感器的别名,与其绑定且可与原传感器名等价使用。
标签和属性的唯一差别在于,我们为标签信息在内存中维护了一个倒排索引,所以可以在`show timeseries`的条件语句中使用标签作为查询条件,你将会在下一节看到具体查询内容。

> 注意:额外的标签和属性信息总的大小不能超过`tag_attribute_total_size`.
## 标签点属性更新
创建时间序列后,我们也可以对其原有的标签点属性进行更新,主要有以下五种更新方式:

Expand Down
4 changes: 2 additions & 2 deletions docs/zh/UserGuide/Operation Manual/SQL Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ Eg. SELECT LAST s1 FROM root.sg.d1, root.sg.d2
As 语句为 SELECT 语句中出现的时间序列规定一个别名

```
在每个查询中都可以使用 As 语句来规定时间序列的别名。
在每个查询中都可以使用 As 语句来规定时间序列的别名,但是对于通配符的使用有一定限制
1. 原始数据查询:
select s1 as speed, s2 as temperature from root.sg.d1
Expand All @@ -628,7 +628,7 @@ select s1 as speed, s2 as temperature from root.sg.d1 align by device
select count(s1) as s1_num, count(s2), count(s3) as s3_num from root.sg.d2 align by device
5. Last 查询
5. 最新数据查询
select last s1 as speed, s2 from root.sg.d1
规则:
Expand Down

0 comments on commit 1b38995

Please sign in to comment.