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

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

commit 7f833836de1ce88a6e17edaefe8901a342bf0b9b
Author: zhutianci <[email protected]>
AuthorDate: Tue Jun 16 09:53:21 2020 +0800

    add compression keyword
---
 docs/UserGuide/Operation Manual/SQL Reference.md   |  6 +-
 .../zh/UserGuide/Operation Manual/SQL Reference.md |  6 +-
 .../org/apache/iotdb/db/qp/strategy/SqlBase.g4     | 41 ++++++++++++-
 .../iotdb/db/qp/strategy/LogicalGenerator.java     | 69 ----------------------
 4 files changed, 44 insertions(+), 78 deletions(-)

diff --git a/docs/UserGuide/Operation Manual/SQL Reference.md 
b/docs/UserGuide/Operation Manual/SQL Reference.md
index b327d45..dedac7a 100644
--- a/docs/UserGuide/Operation Manual/SQL Reference.md  
+++ b/docs/UserGuide/Operation Manual/SQL Reference.md  
@@ -32,14 +32,12 @@ All of these statements are write in IoTDB's own syntax, 
for details about the s
 
 ## Keywords
 
-Please not use these keywords as identifiers.
+Please not use these keywords as identifiers. If you really want to use these 
keywords in your iotdb path, please contact us.
 
 ```
 CREATE, INSERT, UPDATE, DELETE, SELECT, SHOW, GRANT, INTO, SET, WHERE, FROM, 
TO, BY, DEVICE,
 CONFIGURATION, DESCRIBE, SLIMIT, LIMIT, UNLINK, OFFSET, SOFFSET, FILL, LINEAR, 
PREVIOUS, PREVIOUSUNTILLAST,
-METADATA, TIMESERIES, TIMESTAMP, PROPERTY, WITH, ROOT, DATATYPE, COMPRESSOR, 
STORAGE, GROUP, LABEL,INT32,
-INT64, FLOAT, DOUBLE, BOOLEAN, TEXT, ENCODING, PLAIN, PLAIN_DICTIONARY, RLE, 
DIFF, TS_2DIFF, GORILLA, REGULAR,
-BITMAP, ADD, UPSERT, VALUES, NOW, LINK, INDEX, USING, ON, DROP, MERGE, LIST, 
USER, PRIVILEGES, ROLE, ALL, OF,
+METADATA, TIMESERIES, TIMESTAMP, PROPERTY, WITH, ROOT, DATATYPE, COMPRESSOR, 
STORAGE, GROUP, LABEL, ADD, UPSERT, VALUES, NOW, LINK, INDEX, USING, ON, DROP, 
MERGE, LIST, USER, PRIVILEGES, ROLE, ALL, OF,
 ALTER, PASSWORD, REVOKE, LOAD, WATERMARK_EMBEDDING, UNSET, TTL, FLUSH, TASK, 
INFO, DYNAMIC, PARAMETER, VERSION,
 REMOVE, MOVE, CHILD, PATHS, DEVICES, COUNT, NODES, LEVEL, MIN_TIME, MAX_TIME, 
MIN_VALUE, MAX_VALUE, AVG, FIRST_VALUE,
 SUM, LAST_VALUE, LAST, DISABLE, ALIGN, COMPRESSION, TIME, ATTRIBUTES, 
TAGS,RENAME, FULL, CLEAR, CACHE
diff --git a/docs/zh/UserGuide/Operation Manual/SQL Reference.md 
b/docs/zh/UserGuide/Operation Manual/SQL Reference.md
index 154da9e..651858d 100644
--- a/docs/zh/UserGuide/Operation Manual/SQL Reference.md       
+++ b/docs/zh/UserGuide/Operation Manual/SQL Reference.md       
@@ -23,14 +23,12 @@
 
 ## 关键字
 
-不要使用这些关键字作为标识符。
+不要使用这些关键字作为标识符。如果你真的想需要使用这些关键字在你的iotdb路径上,请联系我们。
 
 ```
 CREATE, INSERT, UPDATE, DELETE, SELECT, SHOW, GRANT, INTO, SET, WHERE, FROM, 
TO, BY, DEVICE,
 CONFIGURATION, DESCRIBE, SLIMIT, LIMIT, UNLINK, OFFSET, SOFFSET, FILL, LINEAR, 
PREVIOUS, PREVIOUSUNTILLAST,
-METADATA, TIMESERIES, TIMESTAMP, PROPERTY, WITH, ROOT, DATATYPE, COMPRESSOR, 
STORAGE, GROUP, LABEL,INT32,
-INT64, FLOAT, DOUBLE, BOOLEAN, TEXT, ENCODING, PLAIN, PLAIN_DICTIONARY, RLE, 
DIFF, TS_2DIFF, GORILLA, REGULAR,
-BITMAP, ADD, UPSERT, VALUES, NOW, LINK, INDEX, USING, ON, DROP, MERGE, LIST, 
USER, PRIVILEGES, ROLE, ALL, OF,
+METADATA, TIMESERIES, TIMESTAMP, PROPERTY, WITH, ROOT, DATATYPE, COMPRESSOR, 
STORAGE, GROUP, LABEL, ADD, UPSERT, VALUES, NOW, LINK, INDEX, USING, ON, DROP, 
MERGE, LIST, USER, PRIVILEGES, ROLE, ALL, OF,
 ALTER, PASSWORD, REVOKE, LOAD, WATERMARK_EMBEDDING, UNSET, TTL, FLUSH, TASK, 
INFO, DYNAMIC, PARAMETER, VERSION,
 REMOVE, MOVE, CHILD, PATHS, DEVICES, COUNT, NODES, LEVEL, MIN_TIME, MAX_TIME, 
MIN_VALUE, MAX_VALUE, AVG, FIRST_VALU,
 SUM, LAST_VALUE, LAST, DISABLE, ALIGN, COMPRESSION, TIME, ATTRIBUTES, 
TAGS,RENAME, FULL, CLEAR, CACHE
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 c21e110..849ce03 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
@@ -140,12 +140,22 @@ aliasClause
 
 attributeClauses
     : DATATYPE OPERATOR_EQ dataType COMMA ENCODING OPERATOR_EQ encoding
-    (COMMA (COMPRESSOR | COMPRESSION) OPERATOR_EQ compressor=propertyValue)?
+    (COMMA (COMPRESSOR | COMPRESSION) OPERATOR_EQ compressor)?
     (COMMA property)*
     tagClause
     attributeClause
     ;
 
+compressor
+    : UNCOMPRESSED
+    | SNAPPY
+    | GZIP
+    | LZO
+    | SDT
+    | PAA
+    | PLA
+    ;
+
 attributeClause
     : (ATTRIBUTES LR_BRACKET property (COMMA property)* RR_BRACKET)?
     ;
@@ -369,6 +379,7 @@ nodeName
     | MINUS? INT
     | booleanClause
     | (ID | OPERATOR_IN)? LS_BRACKET ID? RS_BRACKET ID?
+    | compressor
     ;
 
 nodeNameWithoutStar
@@ -382,6 +393,7 @@ nodeNameWithoutStar
     | MINUS? INT
     | booleanClause
     | (ID | OPERATOR_IN)? LS_BRACKET ID? RS_BRACKET ID?
+    | compressor
     ;
 
 dataType
@@ -879,6 +891,33 @@ FALSE
     : F A L S E
     ;
 
+UNCOMPRESSED
+    : U N C O M P R E S S E D
+    ;
+
+SNAPPY
+    : S N A P P Y
+    ;
+
+GZIP
+    : G Z I P
+    ;
+
+LZO
+    : L Z O
+    ;
+
+SDT
+    : S D T
+    ;
+
+PAA
+    : P A A
+    ;
+
+PLA
+   : P L A
+   ;
 //============================
 // End of the keywords list
 //============================
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 8048f86..9ffb5e9 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
@@ -1115,7 +1115,6 @@ public class LogicalGenerator extends SqlBaseBaseListener 
{
     } else {
       compressor = TSFileDescriptor.getInstance().getConfig().getCompressor();
     }
-    checkMetadataArgs(dataType, encoding, compressor.toString().toUpperCase());
     if (ctx.property(0) != null) {
       for (PropertyContext property : properties) {
         props.put(property.ID().getText().toLowerCase(),
@@ -1545,74 +1544,6 @@ public class LogicalGenerator extends 
SqlBaseBaseListener {
     return time;
   }
 
-  private void checkMetadataArgs(String dataType, String encoding, String 
compressor) {
-    TSDataType tsDataType;
-    TSEncoding tsEncoding;
-    if (dataType == null) {
-      throw new SQLParserException("data type cannot be null");
-    }
-
-    try {
-      tsDataType = TSDataType.valueOf(dataType);
-    } catch (Exception e) {
-      throw new SQLParserException(String.format("data type %s not support", 
dataType));
-    }
-
-    if (encoding == null) {
-      throw new SQLParserException("encoding type cannot be null");
-    }
-
-    try {
-      tsEncoding = TSEncoding.valueOf(encoding);
-    } catch (Exception e) {
-      throw new SQLParserException(String.format("encoding %s is not support", 
encoding));
-    }
-
-    try {
-      CompressionType.valueOf(compressor);
-    } catch (Exception e) {
-      throw new SQLParserException(String.format("compressor %s is not 
support", compressor));
-    }
-
-    checkDataTypeEncoding(tsDataType, tsEncoding);
-  }
-
-  private void checkDataTypeEncoding(TSDataType tsDataType, TSEncoding 
tsEncoding) {
-    boolean throwExp = false;
-    switch (tsDataType) {
-      case BOOLEAN:
-        if (!(tsEncoding.equals(TSEncoding.RLE) || 
tsEncoding.equals(TSEncoding.PLAIN))) {
-          throwExp = true;
-        }
-        break;
-      case INT32:
-      case INT64:
-        if (!(tsEncoding.equals(TSEncoding.RLE) || 
tsEncoding.equals(TSEncoding.PLAIN)
-                || tsEncoding.equals(TSEncoding.TS_2DIFF))) {
-          throwExp = true;
-        }
-        break;
-      case FLOAT:
-      case DOUBLE:
-        if (!(tsEncoding.equals(TSEncoding.RLE) || 
tsEncoding.equals(TSEncoding.PLAIN)
-                || tsEncoding.equals(TSEncoding.TS_2DIFF) || 
tsEncoding.equals(TSEncoding.GORILLA))) {
-          throwExp = true;
-        }
-        break;
-      case TEXT:
-        if (!tsEncoding.equals(TSEncoding.PLAIN)) {
-          throwExp = true;
-        }
-        break;
-      default:
-        throwExp = true;
-    }
-    if (throwExp) {
-      throw new SQLParserException(
-              String.format("encoding %s does not support %s", tsEncoding, 
tsDataType));
-    }
-  }
-
   @Override
   public void enterShowMergeStatus(ShowMergeStatusContext ctx) {
     super.enterShowMergeStatus(ctx);

Reply via email to