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:23:38 UTC

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

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

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


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

commit de4216dc3e4f28ddf91c19e7dcf085a9bb76e5bd
Author: Liao Lanyu <14...@qq.com>
AuthorDate: Tue Apr 4 16:23:32 2023 +0800

    [To rel/1.1][IOTDB-5755] Fix the problem that token DURATION_INTERVAL can not be used in Identifier (#9523)
---
 .../org/apache/iotdb/db/qp/sql/IdentifierParser.g4   |  1 +
 .../db/it/IoTDBSyntaxConventionIdentifierIT.java     | 20 ++++++++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IdentifierParser.g4 b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IdentifierParser.g4
index 3477d54f5a..675df24080 100644
--- a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IdentifierParser.g4
+++ b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IdentifierParser.g4
@@ -23,6 +23,7 @@ options { tokenVocab=SqlLexer; }
 
 identifier
      : keyWords
+     | DURATION_LITERAL
      | ID
      | QUOTED_ID
      ;
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionIdentifierIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionIdentifierIT.java
index f134488d1b..010b455907 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionIdentifierIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionIdentifierIT.java
@@ -163,7 +163,10 @@ public class IoTDBSyntaxConventionIdentifierIT {
       "`-0001`",
       "`++1`",
       "`+-1`",
-      "`--1`"
+      "`--1`",
+      "123w",
+      "123d",
+      "123h"
     };
 
     String[] resultTimeseries = {
@@ -187,7 +190,10 @@ public class IoTDBSyntaxConventionIdentifierIT {
       "root.sg1.d1.`-0001`",
       "root.sg1.d1.`++1`",
       "root.sg1.d1.`+-1`",
-      "root.sg1.d1.`--1`"
+      "root.sg1.d1.`--1`",
+      "root.sg1.d1.123w",
+      "root.sg1.d1.123d",
+      "root.sg1.d1.123h"
     };
 
     String[] selectNodeNames = {
@@ -211,7 +217,10 @@ public class IoTDBSyntaxConventionIdentifierIT {
       "`-0001`",
       "`++1`",
       "`+-1`",
-      "`--1`"
+      "`--1`",
+      "123w",
+      "123d",
+      "123h"
     };
 
     String[] suffixInResultColumns = {
@@ -235,7 +244,10 @@ public class IoTDBSyntaxConventionIdentifierIT {
       "`-0001`",
       "`++1`",
       "`+-1`",
-      "`--1`"
+      "`--1`",
+      "123w",
+      "123d",
+      "123h"
     };
 
     try (Connection connection = EnvFactory.getEnv().getConnection();