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

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


The following commit(s) were added to refs/heads/rel/0.12 by this push:
     new 04a51b8  [IOTDB-1561][To rel/0.12]Fix problems caused by keywords 
(#3756)
04a51b8 is described below

commit 04a51b8b8ce8af510de907f7084ee20daad254e9
Author: Hang Ji <[email protected]>
AuthorDate: Mon Aug 16 23:21:28 2021 +0800

    [IOTDB-1561][To rel/0.12]Fix problems caused by keywords (#3756)
---
 antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlBase.g4    | 10 +++-------
 .../IoTDB-SQL-Language/DML-Data-Manipulation-Language.md       |  4 ++--
 .../IoTDB-SQL-Language/DML-Data-Manipulation-Language.md       |  4 ++--
 .../main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java  |  7 ++++---
 .../test/java/org/apache/iotdb/db/integration/IoTDBFillIT.java |  2 +-
 5 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlBase.g4 
b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlBase.g4
index 49585ea..a2bb642 100644
--- a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlBase.g4
+++ b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlBase.g4
@@ -338,7 +338,7 @@ groupByLevelClause
 typeClause
     : (dataType | ALL) LS_BRACKET linearClause RS_BRACKET
     | (dataType | ALL) LS_BRACKET previousClause RS_BRACKET
-    | (dataType | ALL) LS_BRACKET valueClause RS_BRACKET
+    | (dataType | ALL) LS_BRACKET specificValueClause RS_BRACKET
     | (dataType | ALL) LS_BRACKET previousUntilLastClause RS_BRACKET
     ;
 
@@ -350,8 +350,8 @@ previousClause
     : PREVIOUS (COMMA DURATION)?
     ;
 
-valueClause
-    : VALUE (COMMA constant)?
+specificValueClause
+    : constant?
     ;
 
 previousUntilLastClause
@@ -830,10 +830,6 @@ LINEAR
     : L I N E A R
     ;
 
-VALUE
-    : V A L U E
-    ;
-
 PREVIOUS
     : P R E V I O U S
     ;
diff --git 
a/docs/UserGuide/IoTDB-SQL-Language/DML-Data-Manipulation-Language.md 
b/docs/UserGuide/IoTDB-SQL-Language/DML-Data-Manipulation-Language.md
index a17a2de..8780db2 100644
--- a/docs/UserGuide/IoTDB-SQL-Language/DML-Data-Manipulation-Language.md
+++ b/docs/UserGuide/IoTDB-SQL-Language/DML-Data-Manipulation-Language.md
@@ -984,7 +984,7 @@ It costs 0.017s
 When the value of the queried timestamp is null, given fill value is used to 
fill the blank. The formalized value method is as follows:
 
 ```
-select <path> from <prefixPath> where time = <T> fill(<data_type>[value, 
constant]…)
+select <path> from <prefixPath> where time = <T> fill(<data_type>[constant]…)
 ```
 Detailed descriptions of all parameters are given in Table 3-6.
 
@@ -1003,7 +1003,7 @@ Detailed descriptions of all parameters are given in 
Table 3-6.
 Here we give an example of filling null values using the value method. The SQL 
statement is as follows:
 
 ```
-select temperature from root.sgcc.wf03.wt01 where time = 
2017-11-01T16:37:50.000 fill(float [value, 2.0])
+select temperature from root.sgcc.wf03.wt01 where time = 
2017-11-01T16:37:50.000 fill(float [2.0])
 ```
 which means:
 
diff --git 
a/docs/zh/UserGuide/IoTDB-SQL-Language/DML-Data-Manipulation-Language.md 
b/docs/zh/UserGuide/IoTDB-SQL-Language/DML-Data-Manipulation-Language.md
index 6dedb9f..91b213d 100644
--- a/docs/zh/UserGuide/IoTDB-SQL-Language/DML-Data-Manipulation-Language.md
+++ b/docs/zh/UserGuide/IoTDB-SQL-Language/DML-Data-Manipulation-Language.md
@@ -815,7 +815,7 @@ It costs 0.017s
 当查询的时间戳值为空时,将使用给定的值来填充空白。 特定值填充方法如下:
 
 ```
-select <path> from <prefixPath> where time = <T> fill(<data_type>[value, 
constant]…)
+select <path> from <prefixPath> where time = <T> fill(<data_type>[constant]…)
 ```
 
 表3-6中给出了所有参数的详细说明。
@@ -837,7 +837,7 @@ select <path> from <prefixPath> where time = <T> 
fill(<data_type>[value, constan
 在这里,我们举一个使用特定值方法填充空值的示例。 SQL语句如下:
 
 ```
-select temperature from root.sgcc.wf03.wt01 where time = 
2017-11-01T16:37:50.000 fill(float [value, 2.0])
+select temperature from root.sgcc.wf03.wt01 where time = 
2017-11-01T16:37:50.000 fill(float [2.0])
 ```
 
 意思是:
diff --git 
a/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java 
b/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
index d403298..8c1a87c 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
@@ -1574,9 +1574,10 @@ public class IoTDBSqlVisitor extends 
SqlBaseBaseVisitor<Operator> {
       } else {
         fillTypes.put(dataType, new PreviousFill(defaultFillInterval));
       }
-    } else if (ctx.valueClause() != null) {
-      if (ctx.valueClause().constant() != null) {
-        fillTypes.put(dataType, new 
ValueFill(ctx.valueClause().constant().getText(), dataType));
+    } else if (ctx.specificValueClause() != null) {
+      if (ctx.specificValueClause().constant() != null) {
+        fillTypes.put(
+            dataType, new 
ValueFill(ctx.specificValueClause().constant().getText(), dataType));
       } else {
         throw new SQLParserException("fill value cannot be null");
       }
diff --git 
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBFillIT.java 
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBFillIT.java
index 45aabaa..ec527dc 100644
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBFillIT.java
+++ b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBFillIT.java
@@ -322,7 +322,7 @@ public class IoTDBFillIT {
           statement.execute(
               "select temperature,status, hardware "
                   + "from root.ln.wf01.wt01 where time = 7 "
-                  + "Fill(int32[value, 7], double[value, 7], boolean[value, 
true])");
+                  + "Fill(int32[7], double[7], boolean[true])");
 
       Assert.assertTrue(hasResultSet);
       ResultSet resultSet = statement.getResultSet();

Reply via email to