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/26 14:17:20 UTC

[incubator-iotdb] branch master updated: [IOTDB-446] Can not create or query time series whose path starts with a digit but has strings (#843)

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 e8fde6b  [IOTDB-446] Can not create or query time series whose path starts with a digit but has strings (#843)
e8fde6b is described below

commit e8fde6b961195244d52d8ae609d36654adb0bd6e
Author: Boris <zh...@gmail.com>
AuthorDate: Wed Feb 26 22:17:10 2020 +0800

    [IOTDB-446] Can not create or query time series whose path starts with a digit but has strings (#843)
    
    * enable node name starts with number and contains other chars.
---
 .../org/apache/iotdb/db/qp/strategy/SqlBase.g4     | 27 ++++------------------
 .../integration/IOTDBGroupByInnerIntervalIT.java   |  4 ++--
 .../java/org/apache/iotdb/db/qp/PlannerTest.java   | 16 +++++++++----
 3 files changed, 19 insertions(+), 28 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 6a92ea8..81b69c4 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
@@ -289,12 +289,14 @@ nodeName
     | STAR
     | ID STAR
     | STRING_LITERAL
+    | DURATION
     ;
 
 nodeNameWithoutStar
     : INT
     | ID
     | STRING_LITERAL
+    | DURATION
     ;
 
 dataType
@@ -810,7 +812,7 @@ DATETIME
       (('+' | '-') INT ':' INT)?
     ;
 /** Allow unicode rule/token names */
-ID			:	NameStartChar NameChar*;
+ID	:	NameChar NameChar*;
 
 FILE
     :  (('a'..'z'| 'A'..'Z')(':')?)* (('\\' | '/')+ PATH_FRAGMENT) +
@@ -818,31 +820,12 @@ FILE
 
 fragment
 NameChar
-	:   NameStartChar
+	:   'A'..'Z'
+	|   'a'..'z'
 	|   '0'..'9'
 	|   '_'
-	|   '\u00B7'
-	|   '\u0300'..'\u036F'
-	|   '\u203F'..'\u2040'
 	;
 
-fragment
-NameStartChar
-	:   'A'..'Z'
-	|   'a'..'z'
-	|   '\u00C0'..'\u00D6'
-	|   '\u00D8'..'\u00F6'
-	|   '\u00F8'..'\u02FF'
-	|   '\u0370'..'\u037D'
-	|   '\u037F'..'\u1FFF'
-	|   '\u200C'..'\u200D'
-	|   '\u2070'..'\u218F'
-	|   '\u2C00'..'\u2FEF'
-	|   '\u3001'..'\uD7FF'
-	|   '\uF900'..'\uFDCF'
-	|   '\uFDF0'..'\uFFFD'
-	; // ignores | ['\u10000-'\uEFFFF] ;
-
 fragment DOUBLE_QUOTE_STRING_LITERAL
 	:	'"' ('\\' . | ~'"' )*? '"'
 	;
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IOTDBGroupByInnerIntervalIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IOTDBGroupByInnerIntervalIT.java
index 30850a0..2d9c9c2 100644
--- a/server/src/test/java/org/apache/iotdb/db/integration/IOTDBGroupByInnerIntervalIT.java
+++ b/server/src/test/java/org/apache/iotdb/db/integration/IOTDBGroupByInnerIntervalIT.java
@@ -165,7 +165,7 @@ public class IOTDBGroupByInnerIntervalIT {
       boolean hasResultSet = statement.execute(
               "select count(temperature), sum(temperature), avg(temperature) from "
                       + "root.ln.wf01.wt01 where temperature > 3"
-                      + "GROUP BY ([1, 30), 3ms, 5ms)");
+                      + " GROUP BY ([1, 30), 3ms, 5ms)");
 
       assertTrue(hasResultSet);
       int cnt;
@@ -205,7 +205,7 @@ public class IOTDBGroupByInnerIntervalIT {
       boolean hasResultSet = statement.execute(
               "select count(temperature), sum(temperature), avg(temperature) from "
                       + "root.ln.wf01.wt01 where time > 3"
-                      + "GROUP BY ([1, 30), 3ms, 5ms)");
+                      + " GROUP BY ([1, 30), 3ms, 5ms)");
 
       assertTrue(hasResultSet);
       int cnt;
diff --git a/server/src/test/java/org/apache/iotdb/db/qp/PlannerTest.java b/server/src/test/java/org/apache/iotdb/db/qp/PlannerTest.java
index dd1d6c0..772c594 100644
--- a/server/src/test/java/org/apache/iotdb/db/qp/PlannerTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/qp/PlannerTest.java
@@ -101,8 +101,8 @@ public class PlannerTest {
     PhysicalPlan plan1 = processor.parseSQLToPhysicalPlan(createSGStatement);
     assertEquals(OperatorType.SET_STORAGE_GROUP, plan1.getOperatorType());
 
-    String createTSStatement = "create timeseries root.vehicle.d1.s1 with datatype=INT32,encoding=RLE";
-    PhysicalPlan plan2 = processor.parseSQLToPhysicalPlan(createTSStatement);
+    String createTSStatement1 = "create timeseries root.vehicle.d1.s1 with datatype=INT32,encoding=RLE";
+    PhysicalPlan plan2 = processor.parseSQLToPhysicalPlan(createTSStatement1);
     assertEquals(OperatorType.CREATE_TIMESERIES, plan2.getOperatorType());
 
     String deleteTSStatement = "delete timeseries root.vehicle.d1.s1";
@@ -117,8 +117,8 @@ public class PlannerTest {
     PhysicalPlan plan6 = processor.parseSQLToPhysicalPlan(deleteStatement);
     assertEquals(OperatorType.DELETE, plan6.getOperatorType());
 
-    String queryStatement = "select * from root.vehicle where root.vehicle.device1.sensor1 > 50";
-    PhysicalPlan plan7 = processor.parseSQLToPhysicalPlan(queryStatement);
+    String queryStatement1 = "select * from root.vehicle where root.vehicle.device1.sensor1 > 50";
+    PhysicalPlan plan7 = processor.parseSQLToPhysicalPlan(queryStatement1);
     assertEquals(OperatorType.QUERY, plan7.getOperatorType());
 
     String aggregationStatement = "select sum(*) from root.vehicle where root.vehicle.device1.sensor1 > 50";
@@ -136,6 +136,14 @@ public class PlannerTest {
     String insertTimeStatement = "insert into root.vehicle.d0(time,s0) values(10,100)";
     PhysicalPlan plan11 = processor.parseSQLToPhysicalPlan(insertTimeStatement);
     assertEquals(OperatorType.INSERT, plan11.getOperatorType());
+
+    String createTSStatement2 = "create timeseries root.a.b.d_1.1s with datatype=FLOAT,encoding=RLE";
+    PhysicalPlan plan12 = processor.parseSQLToPhysicalPlan(createTSStatement2);
+    assertEquals(OperatorType.CREATE_TIMESERIES, plan12.getOperatorType());
+
+    String queryStatement2 = "select windDirection10min from root.national.4.5.585.9_6666.9_333.88_9";
+    PhysicalPlan plan13 = processor.parseSQLToPhysicalPlan(queryStatement2);
+    assertEquals(OperatorType.QUERY, plan13.getOperatorType());
   }
 
   @Test(expected = ParseCancellationException.class)