You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2020/02/26 08:43:48 UTC

[incubator-iotdb] branch groupbyfill updated: add document

This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch groupbyfill
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/groupbyfill by this push:
     new d8bcffc  add document
d8bcffc is described below

commit d8bcffc799694e3e3d5eeb2d438c386165fe5d9d
Author: JackieTien97 <Ja...@foxmail.com>
AuthorDate: Wed Feb 26 16:43:29 2020 +0800

    add document
---
 .../2-DML (Data Manipulation Language).md          | 24 +++++++++++++++++++
 .../5-Operation Manual/4-SQL Reference.md          | 24 +++++++++++++++++++
 .../2-DML (Data Manipulation Language).md          | 27 ++++++++++++++++++++++
 .../5-Operation Manual/4-SQL Reference.md          | 24 +++++++++++++++++++
 4 files changed, 99 insertions(+)

diff --git a/docs/Documentation-CHN/UserGuide/5-Operation Manual/2-DML (Data Manipulation Language).md b/docs/Documentation-CHN/UserGuide/5-Operation Manual/2-DML (Data Manipulation Language).md
index 0bfaa96..ef277f9 100644
--- a/docs/Documentation-CHN/UserGuide/5-Operation Manual/2-DML (Data Manipulation Language).md	
+++ b/docs/Documentation-CHN/UserGuide/5-Operation Manual/2-DML (Data Manipulation Language).md	
@@ -253,6 +253,30 @@ select count(status), max_value(temperature) from root.ln.wf01.wt01 where time >
 
 <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/69116088-001e2780-0ac6-11ea-9a01-dc45271d1dad.png"></center>
 
+#### 带Fill子句的降频聚合查询
+
+带Fill子句的降频聚合查询中,Group by子句不支持滑动步长
+
+Fill子句中仅能使用Previous和PREVIOUSUNTILLAST这两种插值方式,Linear不支持
+
+Previous和PREVIOUSUNTILLAST对fill的时间不做限制
+
+填充只针对last_value这一聚合函数,其他的函数不支持,如果其他函数的聚合值查询结果为null,依旧为null,不进行填充
+
+##### PREVIOUSUNTILLAST与PREVIOUS填充的区别
+
+* Previous填充方式的语意没有变,只要前面有值,就可以拿过来填充;
+* PREVIOUSUNTILLAST考虑到在某些业务场景下,所填充的值的时间不能大于该时间序列last的时间戳(从业务角度考虑,取历史数据不能取未来历史数据)
+
+对应的SQL语句是
+
+```
+SELECT last_value(temperature) as last_temperature FROM root.ln.wf01.wt01 GROUP BY([8, 39), 5m) FILL (int32[PREVIOUSUNTILLAST])
+```
+这条查询的含义是用PREVIOUSUNTILLAST的Fill方式填充原来的聚合查询结果
+
+
+
 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>
diff --git a/docs/Documentation-CHN/UserGuide/5-Operation Manual/4-SQL Reference.md b/docs/Documentation-CHN/UserGuide/5-Operation Manual/4-SQL Reference.md
index 1ec1d2d..2926043 100644
--- a/docs/Documentation-CHN/UserGuide/5-Operation Manual/4-SQL Reference.md	
+++ b/docs/Documentation-CHN/UserGuide/5-Operation Manual/4-SQL Reference.md	
@@ -305,6 +305,30 @@ Note: the statement needs to satisfy this constraint: <PrefixPath>(FromClause) +
 Note: Integer in <TimeUnit> needs to be greater than 0
 ```
 
+* Group By Fill语句
+
+```
+SELECT <SelectClause> FROM <FromClause> WHERE  <WhereClause> GROUP BY <GroupByClause> (FILL <GROUPBYFillClause>)?
+GroupByClause : LPAREN <TimeInterval> COMMA <TimeUnit> RPAREN
+GROUPBYFillClause : LPAREN <TypeClause> RPAREN
+TypeClause : <AllClause> | <Int32Clause> | <Int64Clause> | <FloatClause> | <DoubleClause> | <BoolClause> | <TextClause> 
+AllClause: ALL LBRACKET (<PreviousUntilLastClause> | <PreviousClause>)  RBRACKET
+Int32Clause: INT32 LBRACKET (<PreviousUntilLastClause> | <PreviousClause>)  RBRACKET
+Int64Clause: INT64 LBRACKET (<PreviousUntilLastClause> | <PreviousClause>)  RBRACKET
+FloatClause: FLOAT LBRACKET (<PreviousUntilLastClause> | <PreviousClause>)  RBRACKET
+DoubleClause: DOUBLE LBRACKET (<PreviousUntilLastClause> | <PreviousClause>)  RBRACKET
+BoolClause: BOOLEAN LBRACKET (<PreviousUntilLastClause> | <PreviousClause>)  RBRACKET
+TextClause: TEXT LBRACKET (<PreviousUntilLastClause> | <PreviousClause>)  RBRACKET
+PreviousClause : PREVIOUS
+PreviousUntilLastClause : PREVIOUSUNTILLAST
+Eg: SELECT last_value(temperature) FROM root.ln.wf01.wt01 GROUP BY([20, 100), 5m) FILL (float[PREVIOUS])
+Eg: SELECT last_value(power) FROM root.ln.wf01.wt01 GROUP BY([20, 100), 5m) FILL (int32[PREVIOUSUNTILLAST])
+Eg: SELECT last_value(temperature), last_value(power) FROM root.ln.wf01.wt01 GROUP BY([20, 100), 5m) FILL (ALL[PREVIOUS])
+Note: In group by fill, sliding step is not supported in group by clause
+Note: Now, only last_value aggregation function is supported in group by fill.
+Note: Linear fill is not supported in group by fill.
+```
+
 * Limit语句
 
 ```
diff --git a/docs/Documentation/UserGuide/5-Operation Manual/2-DML (Data Manipulation Language).md b/docs/Documentation/UserGuide/5-Operation Manual/2-DML (Data Manipulation Language).md
index 4594908..778776d 100644
--- a/docs/Documentation/UserGuide/5-Operation Manual/2-DML (Data Manipulation Language).md	
+++ b/docs/Documentation/UserGuide/5-Operation Manual/2-DML (Data Manipulation Language).md	
@@ -232,6 +232,33 @@ Then the system will use the time and value filtering condition in the WHERE cla
 
 <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/69116088-001e2780-0ac6-11ea-9a01-dc45271d1dad.png"></center>
 
+#### Down-Frequency Aggregate Query with Fill Clause
+
+In group by fill, sliding step is not supported in group by clause
+
+Now, only last_value aggregation function is supported in group by fill.
+
+There is no limit about time in group by fill.
+
+Linear fill is not supported in group by fill.
+
+
+##### Difference Between PREVIOUSUNTILLAST And PREVIOUS
+
+* PREVIOUS will fill any null value as long as there exist value is not null before it.
+* PREVIOUSUNTILLAST won't fill the result whose time is after the last time of that time series.
+
+The SQL statement is:
+
+```
+SELECT last_value(temperature) as last_temperature FROM root.ln.wf01.wt01 GROUP BY([8, 39), 5m) FILL (int32[PREVIOUSUNTILLAST])
+```
+which means:
+
+using PREVIOUSUNTILLAST Fill way to fill the origin down-frequency aggregate query result.
+
+
+
 The path after SELECT in GROUP BY statement must be aggregate function, otherwise the system will give the corresponding error prompt, as shown below:
 
 <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>
diff --git a/docs/Documentation/UserGuide/5-Operation Manual/4-SQL Reference.md b/docs/Documentation/UserGuide/5-Operation Manual/4-SQL Reference.md
index b20d3fa..a447247 100644
--- a/docs/Documentation/UserGuide/5-Operation Manual/4-SQL Reference.md	
+++ b/docs/Documentation/UserGuide/5-Operation Manual/4-SQL Reference.md	
@@ -312,6 +312,30 @@ Note: the statement needs to satisfy this constraint: <PrefixPath>(FromClause) +
 Note: Integer in <TimeUnit> needs to be greater than 0
 ```
 
+* Group By Fill Statement
+
+```
+SELECT <SelectClause> FROM <FromClause> WHERE  <WhereClause> GROUP BY <GroupByClause> (FILL <GROUPBYFillClause>)?
+GroupByClause : LPAREN <TimeInterval> COMMA <TimeUnit> RPAREN
+GROUPBYFillClause : LPAREN <TypeClause> RPAREN
+TypeClause : <AllClause> | <Int32Clause> | <Int64Clause> | <FloatClause> | <DoubleClause> | <BoolClause> | <TextClause> 
+AllClause: ALL LBRACKET (<PreviousUntilLastClause> | <PreviousClause>)  RBRACKET
+Int32Clause: INT32 LBRACKET (<PreviousUntilLastClause> | <PreviousClause>)  RBRACKET
+Int64Clause: INT64 LBRACKET (<PreviousUntilLastClause> | <PreviousClause>)  RBRACKET
+FloatClause: FLOAT LBRACKET (<PreviousUntilLastClause> | <PreviousClause>)  RBRACKET
+DoubleClause: DOUBLE LBRACKET (<PreviousUntilLastClause> | <PreviousClause>)  RBRACKET
+BoolClause: BOOLEAN LBRACKET (<PreviousUntilLastClause> | <PreviousClause>)  RBRACKET
+TextClause: TEXT LBRACKET (<PreviousUntilLastClause> | <PreviousClause>)  RBRACKET
+PreviousClause : PREVIOUS
+PreviousUntilLastClause : PREVIOUSUNTILLAST
+Eg: SELECT last_value(temperature) FROM root.ln.wf01.wt01 GROUP BY([20, 100), 5m) FILL (float[PREVIOUS])
+Eg: SELECT last_value(power) FROM root.ln.wf01.wt01 GROUP BY([20, 100), 5m) FILL (int32[PREVIOUSUNTILLAST])
+Eg: SELECT last_value(temperature), last_value(power) FROM root.ln.wf01.wt01 GROUP BY([20, 100), 5m) FILL (ALL[PREVIOUS])
+Note: In group by fill, sliding step is not supported in group by clause
+Note: Now, only last_value aggregation function is supported in group by fill.
+Note: Linear fill is not supported in group by fill.
+```
+
 * Limit Statement
 
 ```