You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hu...@apache.org on 2023/04/04 08:22:25 UTC

[iotdb] branch rel/0.13 updated: [To rel/0.13][IOTDB-5755] Fix the problem that token DURATION_INTERVAL can not be used in Identifier (#9522)

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

hui pushed a commit to branch rel/0.13
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/0.13 by this push:
     new fc0f7f948d [To rel/0.13][IOTDB-5755] Fix the problem that token DURATION_INTERVAL can not be used in Identifier (#9522)
fc0f7f948d is described below

commit fc0f7f948d7b005275f456f9c086fef1e7ecee4b
Author: Liao Lanyu <14...@qq.com>
AuthorDate: Tue Apr 4 16:22:18 2023 +0800

    [To rel/0.13][IOTDB-5755] Fix the problem that token DURATION_INTERVAL can not be used in Identifier (#9522)
---
 .../antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4  |  4 ++++
 .../iotdb/db/integration/IoTDBSyntaxConventionIT.java    | 16 ++++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
index 3bcfc7c2a0..cbd0772781 100644
--- a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
+++ b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
@@ -750,6 +750,7 @@ nodeName
     | wildcard? INTEGER_LITERAL wildcard?
     | QUTOED_ID_IN_NODE_NAME
     | STRING_LITERAL
+    | DURATION_LITERAL
     ;
 
 nodeNameWithoutWildcard
@@ -757,6 +758,7 @@ nodeNameWithoutWildcard
     | INTEGER_LITERAL
     | QUTOED_ID_IN_NODE_NAME
     | STRING_LITERAL
+    | DURATION_LITERAL
     ;
 
 suffixPathCanInExpr
@@ -768,6 +770,7 @@ nodeNameCanInExpr
     | wildcard? ID wildcard?
     | QUTOED_ID
     | QUTOED_ID_IN_NODE_NAME
+    | DURATION_LITERAL
     ;
 
 wildcard
@@ -783,6 +786,7 @@ identifier
     | QUTOED_ID
     | QUTOED_ID_IN_NODE_NAME
     | INTEGER_LITERAL
+    | DURATION_LITERAL
     ;
 
 
diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSyntaxConventionIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSyntaxConventionIT.java
index 0d868ca1e7..36ff83489c 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSyntaxConventionIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSyntaxConventionIT.java
@@ -250,7 +250,9 @@ public class IoTDBSyntaxConventionIT {
       "'.a'",
       "`\\\"a`",
       "`a\\\"`",
-      "\"a\\\".\\\"b\""
+      "\"a\\\".\\\"b\"",
+      "123w",
+      "123d",
     };
     String[] selectNodeNames = {
       "`select`",
@@ -268,7 +270,9 @@ public class IoTDBSyntaxConventionIT {
       "`'.a'`",
       "`\\\"a`",
       "`a\\\"`",
-      "`\"a\\\".\\\"b\"`"
+      "`\"a\\\".\\\"b\"`",
+      "123w",
+      "123d",
     };
     String[] resultNodeNames = {
       "select",
@@ -286,7 +290,9 @@ public class IoTDBSyntaxConventionIT {
       "'.a'",
       "\\\"a",
       "a\\\"",
-      "\"a\\\".\\\"b\""
+      "\"a\\\".\\\"b\"",
+      "123w",
+      "123d",
     };
     String[] resultTimeseries = {
       "root.sg1.d1.select",
@@ -304,7 +310,9 @@ public class IoTDBSyntaxConventionIT {
       "root.sg1.d1.'.a'",
       "root.sg1.d1.\\\"a",
       "root.sg1.d1.a\\\"",
-      "root.sg1.d1.\"a\\\".\\\"b\""
+      "root.sg1.d1.\"a\\\".\\\"b\"",
+      "root.sg1.d1.123w",
+      "root.sg1.d1.123d",
     };
     try (Connection connection = EnvFactory.getEnv().getConnection();
         Statement statement = connection.createStatement()) {