This is an automated email from the ASF dual-hosted git repository. geniuspig pushed a commit to branch support_special_characters_v2 in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
commit c8a6f44e547e1d43b185bc528767b10d42ffa48e Author: zhutianci <[email protected]> AuthorDate: Sun May 24 14:14:05 2020 +0800 support special characters. --- .../org/apache/iotdb/db/qp/strategy/SqlBase.g4 | 44 +++++++++++++++------- .../apache/iotdb/db/qp/plan/PhysicalPlanTest.java | 7 ++++ 2 files changed, 38 insertions(+), 13 deletions(-) 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 4c56b68..98ef100 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 @@ -323,15 +323,9 @@ timeValue propertyValue : ID - | MINUS? INT - | MINUS? realLiteral | STRING_LITERAL ; -propertyLabelPair - : propertyName=ID DOT labelName=ID - ; - fullPath : ROOT (DOT nodeNameWithoutStar)* ; @@ -346,18 +340,21 @@ suffixPath nodeName : ID - | INT | STAR | ID STAR - | STRING_LITERAL | DURATION + | encoding + | dataType + | constant ; nodeNameWithoutStar - : INT - | ID + : ID | STRING_LITERAL | DURATION + | encoding + | dataType + | constant ; dataType @@ -371,7 +368,6 @@ dateFormat constant : dateExpression - | ID | MINUS? realLiteral | MINUS? INT | STRING_LITERAL @@ -912,12 +908,12 @@ DATETIME INT ':' INT ':' INT (DOT INT)? (('+' | '-') INT ':' INT)?)? ; -/** Allow unicode rule/token names */ -ID : NAME_CHAR NAME_CHAR*; FILE : (('a'..'z'| 'A'..'Z')(':')?)* (('\\' | '/')+ PATH_FRAGMENT) + ; +/** Allow unicode rule/token names */ +ID : FIRST_NAME_CHAR NAME_CHAR*; fragment NAME_CHAR @@ -925,6 +921,28 @@ NAME_CHAR | 'a'..'z' | '0'..'9' | '_' + | '-' + | '/' + | '@' + | '#' + | '$' + | '%' + | '&' + | CN_CHAR + ; + +fragment +FIRST_NAME_CHAR + : 'A'..'Z' + | 'a'..'z' + | '0'..'9' + | '_' + | '/' + | '@' + | '#' + | '$' + | '%' + | '&' | CN_CHAR ; diff --git a/server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java b/server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java index 7fe7250..ce47702 100644 --- a/server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java +++ b/server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java @@ -796,4 +796,11 @@ public class PhysicalPlanTest { assertEquals(TSDataType.FLOAT, dt); } } + + @Test + public void testSpecialCharacters() throws QueryProcessException { + String sqlStr1 = "create timeseries root.3e-3.-1.1/2.SNAPPY.RLE with datatype=FLOAT, encoding=RLE, compression=SNAPPY tags(tag1=v1, tag2=v2) attributes(attr1=v1, attr2=v2)"; + PhysicalPlan plan1 = processor.parseSQLToPhysicalPlan(sqlStr1); + Assert.assertEquals(OperatorType.CREATE_TIMESERIES, plan1.getOperatorType()); + } }
