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/02/28 07:25:36 UTC

[incubator-iotdb] branch master updated: [IOTDB-380] Update storage group path (#853)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 9340de3  [IOTDB-380] Update storage group path (#853)
9340de3 is described below

commit 9340de30b00b1b43d88d5f64b369c3a07f50f886
Author: 张宇欣 <54...@qq.com>
AuthorDate: Fri Feb 28 15:25:26 2020 +0800

    [IOTDB-380] Update storage group path (#853)
    
    * forbidden * in set/delete storage group path
---
 .../5-Operation Manual/4-SQL Reference.md          |  10 +-
 .../1-DDL (Data Definition Language).md            |   2 +
 .../5-Operation Manual/4-SQL Reference.md          |  10 +-
 .../resources/conf/iotdb-engine.properties         |   4 +-
 .../org/apache/iotdb/db/qp/strategy/SqlBase.g4     | 140 ++++++++++-----------
 .../iotdb/db/qp/strategy/LogicalGenerator.java     |  16 +--
 6 files changed, 92 insertions(+), 90 deletions(-)

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 7e07a88..4d3a530 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	
@@ -43,23 +43,23 @@ It costs 0.417s
 * 设置存储组
 
 ``` SQL
-SET STORAGE GROUP TO <PrefixPath>
+SET STORAGE GROUP TO <FullPath>
 Eg: IoTDB > SET STORAGE GROUP TO root.ln.wf01.wt01
-Note: PrefixPath can not include `*`
+Note: FullPath can not include `*`
 ```
 * 删除存储组
 
 ```
-DELETE STORAGE GROUP <PrefixPath> [COMMA <PrefixPath>]*
+DELETE STORAGE GROUP <FullPath> [COMMA <FullPath>]*
 Eg: IoTDB > DELETE STORAGE GROUP root.ln.wf01.wt01
 Eg: IoTDB > DELETE STORAGE GROUP root.ln.wf01.wt01, root.ln.wf01.wt02
-Note: PrefixPath can not include `*`
+Note: FullPath can not include `*`
 ```
 
 * 创建时间序列语句
 
 ```
-CREATE TIMESERIES <Timeseries> WITH <AttributeClauses>
+CREATE TIMESERIES <FullPath> WITH <AttributeClauses>
 AttributeClauses : DATATYPE=<DataTypeValue> COMMA ENCODING=<EncodingValue> [COMMA <ExtraAttributeClause>]*
 DataTypeValue: BOOLEAN | DOUBLE | FLOAT | INT32 | INT64 | TEXT
 EncodingValue: GORILLA | PLAIN | RLE | TS_2DIFF | REGULAR
diff --git a/docs/Documentation/UserGuide/5-Operation Manual/1-DDL (Data Definition Language).md b/docs/Documentation/UserGuide/5-Operation Manual/1-DDL (Data Definition Language).md
index 54a99ed..b32ac9d 100644
--- a/docs/Documentation/UserGuide/5-Operation Manual/1-DDL (Data Definition Language).md	
+++ b/docs/Documentation/UserGuide/5-Operation Manual/1-DDL (Data Definition Language).md	
@@ -40,6 +40,7 @@ Msg: org.apache.iotdb.exception.MetadataErrorException: org.apache.iotdb.excepti
 ```
 
 ### Show Storage Group
+
 After the storage group is created, we can use the [SHOW STORAGE GROUP](/#/Documents/progress/chap5/sec4) statement to view all the storage groups. The SQL statement is as follows:
 
 ```
@@ -51,6 +52,7 @@ The result is as follows:
 
 
 ### Create Timeseries
+
 According to the storage model selected before, we can create corresponding timeseries in the two storage groups respectively. The SQL statements for creating timeseries are as follows:
 
 ```
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 0c467a3..c4fa9b9 100644
--- a/docs/Documentation/UserGuide/5-Operation Manual/4-SQL Reference.md	
+++ b/docs/Documentation/UserGuide/5-Operation Manual/4-SQL Reference.md	
@@ -51,24 +51,24 @@ It costs 0.417s
 * Set Storage Group
 
 ``` SQL
-SET STORAGE GROUP TO <PrefixPath>
+SET STORAGE GROUP TO <FullPath>
 Eg: IoTDB > SET STORAGE GROUP TO root.ln.wf01.wt01
-Note: PrefixPath can not include `*`
+Note: FullPath can not include `*`
 ```
 
 * Delete Storage Group
 
 ```
-DELETE STORAGE GROUP <PrefixPath> [COMMA <PrefixPath>]*
+DELETE STORAGE GROUP <FullPath> [COMMA <FullPath>]*
 Eg: IoTDB > DELETE STORAGE GROUP root.ln.wf01.wt01
 Eg: IoTDB > DELETE STORAGE GROUP root.ln.wf01.wt01, root.ln.wf01.wt02
-Note: PrefixPath can not include `*`
+Note: FullPath can not include `*`
 ```
 
 * Create Timeseries Statement
 
 ```
-CREATE TIMESERIES <Timeseries> WITH <AttributeClauses>
+CREATE TIMESERIES <FullPath> WITH <AttributeClauses>
 AttributeClauses : DATATYPE=<DataTypeValue> COMMA ENCODING=<EncodingValue> [COMMA <ExtraAttributeClause>]*
 DataTypeValue: BOOLEAN | DOUBLE | FLOAT | INT32 | INT64 | TEXT
 EncodingValue: GORILLA | PLAIN | RLE | TS_2DIFF | REGULAR
diff --git a/server/src/assembly/resources/conf/iotdb-engine.properties b/server/src/assembly/resources/conf/iotdb-engine.properties
index f9906c7..eb4e32d 100644
--- a/server/src/assembly/resources/conf/iotdb-engine.properties
+++ b/server/src/assembly/resources/conf/iotdb-engine.properties
@@ -430,11 +430,11 @@ compressor=SNAPPY
 # Time series data will divide into groups by this time range
 # Unit is second
 # default value is one week, which is 604800 seconds
-partition_interval = 604800
+partition_interval=604800
 
 # the num of memtables in each storage group
 # This config decides how many time partitions in a storage group can be inserted concurrently
 # For example, your partitionInterval is 86400 and you want to insert data in 3 different days,
 # you should set this param >= 6 (for sequence and unsequence)
 # default number is 10
-memtable_num_in_each_storage_group = 10
\ No newline at end of file
+memtable_num_in_each_storage_group=10
\ No newline at end of file
diff --git a/server/src/main/antlr4/org/apache/iotdb/db/qp/strategy/SqlBase.g4 b/server/src/main/antlr4/org/apache/iotdb/db/qp/strategy/SqlBase.g4
index 81b69c4..8dc81d2 100644
--- a/server/src/main/antlr4/org/apache/iotdb/db/qp/strategy/SqlBase.g4
+++ b/server/src/main/antlr4/org/apache/iotdb/db/qp/strategy/SqlBase.g4
@@ -24,17 +24,17 @@ singleStatement
     ;
 
 statement
-    : CREATE TIMESERIES timeseriesPath WITH attributeClauses #createTimeseries
+    : CREATE TIMESERIES fullPath WITH attributeClauses #createTimeseries
     | DELETE TIMESERIES prefixPath (COMMA prefixPath)* #deleteTimeseries
-    | INSERT INTO timeseriesPath insertColumnSpec VALUES insertValuesSpec #insertStatement
+    | INSERT INTO fullPath insertColumnSpec VALUES insertValuesSpec #insertStatement
     | UPDATE prefixPath setClause whereClause? #updateStatement
     | DELETE FROM prefixPath (COMMA prefixPath)* (whereClause)? #deleteStatement
-    | SET STORAGE GROUP TO prefixPath #setStorageGroup
-    | DELETE STORAGE GROUP prefixPath (COMMA prefixPath)* #deleteStorageGroup
+    | SET STORAGE GROUP TO fullPath #setStorageGroup
+    | DELETE STORAGE GROUP fullPath (COMMA fullPath)* #deleteStorageGroup
     | SHOW METADATA #showMetadata // not support yet
     | DESCRIBE prefixPath #describePath // not support yet
-    | CREATE INDEX ON timeseriesPath USING function=ID indexWithClause? whereClause? #createIndex //not support yet
-    | DROP INDEX function=ID ON timeseriesPath #dropIndex //not support yet
+    | CREATE INDEX ON fullPath USING function=ID indexWithClause? whereClause? #createIndex //not support yet
+    | DROP INDEX function=ID ON fullPath #dropIndex //not support yet
     | MERGE #merge //not support yet
     | CREATE USER userName=ID password=STRING_LITERAL #createUser
     | ALTER USER userName=(ROOT|ID) SET PASSWORD password=STRING_LITERAL #alterUser
@@ -77,7 +77,7 @@ statement
     | MOVE FILE FILE #moveFile
     | SELECT INDEX func=ID //not support yet
     LR_BRACKET
-    p1=timeseriesPath COMMA p2=timeseriesPath COMMA n1=timeValue COMMA n2=timeValue COMMA
+    p1=fullPath COMMA p2=fullPath COMMA n1=timeValue COMMA n2=timeValue COMMA
     epsilon=constant (COMMA alpha=constant COMMA beta=constant)?
     RR_BRACKET
     fromClause
@@ -271,7 +271,7 @@ propertyLabelPair
     : propertyName=ID DOT labelName=ID
     ;
 
-timeseriesPath
+fullPath
     : ROOT (DOT nodeNameWithoutStar)*
     ;
 
@@ -812,7 +812,7 @@ DATETIME
       (('+' | '-') INT ':' INT)?
     ;
 /** Allow unicode rule/token names */
-ID	:	NameChar NameChar*;
+ID : NameChar NameChar*;
 
 FILE
     :  (('a'..'z'| 'A'..'Z')(':')?)* (('\\' | '/')+ PATH_FRAGMENT) +
@@ -820,124 +820,124 @@ FILE
 
 fragment
 NameChar
-	:   'A'..'Z'
-	|   'a'..'z'
-	|   '0'..'9'
-	|   '_'
-	;
+    :   'A'..'Z'
+    |   'a'..'z'
+    |   '0'..'9'
+    |   '_'
+    ;
 
 fragment DOUBLE_QUOTE_STRING_LITERAL
-	:	'"' ('\\' . | ~'"' )*? '"'
-	;
+    : '"' ('\\' . | ~'"' )*? '"'
+    ;
 
 fragment SINGLE_QUOTE_STRING_LITERAL
-  : '\'' ('\\' . | ~'\'' )*? '\''
-  ;
+    : '\'' ('\\' . | ~'\'' )*? '\''
+    ;
 
 //Characters and write it this way for case sensitivity
 fragment A
-  : 'a' | 'A'
-  ;
+    : 'a' | 'A'
+    ;
 
 fragment B
-  : 'b' | 'B'
-  ;
+    : 'b' | 'B'
+    ;
 
 fragment C
-	: 'c' | 'C'
-	;
+    : 'c' | 'C'
+    ;
 
 fragment D
-	: 'd' | 'D'
-	;
+    : 'd' | 'D'
+    ;
 
 fragment E
-	: 'e' | 'E'
-	;
+    : 'e' | 'E'
+    ;
 
 fragment F
-	: 'f' | 'F'
-	;
+    : 'f' | 'F'
+    ;
 
 fragment G
-	: 'g' | 'G'
-	;
+    : 'g' | 'G'
+    ;
 
 fragment H
-	: 'h' | 'H'
-	;
+    : 'h' | 'H'
+    ;
 
 fragment I
-	: 'i' | 'I'
-	;
+    : 'i' | 'I'
+    ;
 
 fragment J
-	: 'j' | 'J'
-	;
+    : 'j' | 'J'
+    ;
 
 fragment K
-	: 'k' | 'K'
-	;
+    : 'k' | 'K'
+    ;
 
 fragment L
-	: 'l' | 'L'
-	;
+    : 'l' | 'L'
+    ;
 
 fragment M
-	: 'm' | 'M'
-	;
+    : 'm' | 'M'
+    ;
 
 fragment N
-	: 'n' | 'N'
-	;
+    : 'n' | 'N'
+    ;
 
 fragment O
-	: 'o' | 'O'
-	;
+    : 'o' | 'O'
+    ;
 
 fragment P
-	: 'p' | 'P'
-	;
+    : 'p' | 'P'
+    ;
 
 fragment Q
-	: 'q' | 'Q'
-	;
+    : 'q' | 'Q'
+    ;
 
 fragment R
-	: 'r' | 'R'
-	;
+    : 'r' | 'R'
+    ;
 
 fragment S
-	: 's' | 'S'
-	;
+    : 's' | 'S'
+    ;
 
 fragment T
-	: 't' | 'T'
-	;
+    : 't' | 'T'
+    ;
 
 fragment U
-	: 'u' | 'U'
-	;
+    : 'u' | 'U'
+    ;
 
 fragment V
-	: 'v' | 'V'
-	;
+    : 'v' | 'V'
+    ;
 
 fragment W
-	: 'w' | 'W'
-	;
+    : 'w' | 'W'
+    ;
 
 fragment X
-	: 'x' | 'X'
-	;
+    : 'x' | 'X'
+    ;
 
 fragment Y
-	: 'y' | 'Y'
-	;
+    : 'y' | 'Y'
+    ;
 
 fragment Z
-	: 'z' | 'Z'
-	;
+    : 'z' | 'Z'
+    ;
 
 fragment PATH_FRAGMENT
     : ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|'-'|'.')*
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java b/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
index 9c5d837..272bc14 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
@@ -80,6 +80,7 @@ import org.apache.iotdb.db.qp.strategy.SqlBaseParser.DropRoleContext;
 import org.apache.iotdb.db.qp.strategy.SqlBaseParser.DropUserContext;
 import org.apache.iotdb.db.qp.strategy.SqlBaseParser.FillClauseContext;
 import org.apache.iotdb.db.qp.strategy.SqlBaseParser.FromClauseContext;
+import org.apache.iotdb.db.qp.strategy.SqlBaseParser.FullPathContext;
 import org.apache.iotdb.db.qp.strategy.SqlBaseParser.FunctionCallContext;
 import org.apache.iotdb.db.qp.strategy.SqlBaseParser.FunctionElementContext;
 import org.apache.iotdb.db.qp.strategy.SqlBaseParser.GrantRoleContext;
@@ -135,7 +136,6 @@ import org.apache.iotdb.db.qp.strategy.SqlBaseParser.SlimitClauseContext;
 import org.apache.iotdb.db.qp.strategy.SqlBaseParser.SoffsetClauseContext;
 import org.apache.iotdb.db.qp.strategy.SqlBaseParser.SuffixPathContext;
 import org.apache.iotdb.db.qp.strategy.SqlBaseParser.TimeIntervalContext;
-import org.apache.iotdb.db.qp.strategy.SqlBaseParser.TimeseriesPathContext;
 import org.apache.iotdb.db.qp.strategy.SqlBaseParser.TypeClauseContext;
 import org.apache.iotdb.db.qp.strategy.SqlBaseParser.UnsetTTLStatementContext;
 import org.apache.iotdb.db.qp.strategy.SqlBaseParser.UpdateStatementContext;
@@ -298,7 +298,7 @@ public class LogicalGenerator extends SqlBaseBaseListener {
     super.enterCreateTimeseries(ctx);
     createTimeSeriesOperator = new CreateTimeSeriesOperator(SQLConstant.TOK_METADATA_CREATE);
     operatorType = SQLConstant.TOK_METADATA_CREATE;
-    createTimeSeriesOperator.setPath(parseTimeseriesPath(ctx.timeseriesPath()));
+    createTimeSeriesOperator.setPath(parseFullPath(ctx.fullPath()));
   }
 
   @Override
@@ -624,7 +624,7 @@ public class LogicalGenerator extends SqlBaseBaseListener {
     super.enterSetStorageGroup(ctx);
     SetStorageGroupOperator setStorageGroupOperator = new SetStorageGroupOperator(
         SQLConstant.TOK_METADATA_SET_FILE_LEVEL);
-    Path path = parsePrefixPath(ctx.prefixPath());
+    Path path = parseFullPath(ctx.fullPath());
     setStorageGroupOperator.setPath(path);
     initializedOperator = setStorageGroupOperator;
     operatorType = SQLConstant.TOK_METADATA_SET_FILE_LEVEL;
@@ -634,9 +634,9 @@ public class LogicalGenerator extends SqlBaseBaseListener {
   public void enterDeleteStorageGroup(DeleteStorageGroupContext ctx) {
     super.enterDeleteStorageGroup(ctx);
     List<Path> deletePaths = new ArrayList<>();
-    List<PrefixPathContext> prefixPaths = ctx.prefixPath();
-    for (PrefixPathContext prefixPath : prefixPaths) {
-      deletePaths.add(parsePrefixPath(prefixPath));
+    List<FullPathContext> fullPaths = ctx.fullPath();
+    for (FullPathContext fullPath : fullPaths) {
+      deletePaths.add(parseFullPath(fullPath));
     }
     DeleteStorageGroupOperator deleteStorageGroupOperator = new DeleteStorageGroupOperator(
         SQLConstant.TOK_METADATA_DELETE_FILE_LEVEL);
@@ -870,7 +870,7 @@ public class LogicalGenerator extends SqlBaseBaseListener {
     initializedOperator = insertOp;
   }
 
-  private Path parseTimeseriesPath(TimeseriesPathContext ctx) {
+  private Path parseFullPath(FullPathContext ctx) {
     List<NodeNameWithoutStarContext> nodeNamesWithoutStar = ctx.nodeNameWithoutStar();
     List<String> path = new ArrayList<>();
     if (ctx.ROOT() != null) {
@@ -916,7 +916,7 @@ public class LogicalGenerator extends SqlBaseBaseListener {
     insertOp = new InsertOperator(SQLConstant.TOK_INSERT);
     selectOp = new SelectOperator(SQLConstant.TOK_SELECT);
     operatorType = SQLConstant.TOK_INSERT;
-    selectOp.addSelectPath(parseTimeseriesPath(ctx.timeseriesPath()));
+    selectOp.addSelectPath(parseFullPath(ctx.fullPath()));
     insertOp.setSelectOperator(selectOp);
   }