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

JackieTien97 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 7e488ffcaca modify the antlr syntax to adapt the calc-point project 
(#17783)
7e488ffcaca is described below

commit 7e488ffcacabdce013c3e2986b2694c44f4953aa
Author: alpass163 <[email protected]>
AuthorDate: Thu May 28 17:05:25 2026 +0800

    modify the antlr syntax to adapt the calc-point project (#17783)
---
 .../org/apache/iotdb/db/qp/sql/IdentifierParser.g4 |  2 ++
 .../org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4   | 27 ++++++++++++++++++++++
 .../antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4  | 12 ++++++++++
 .../db/queryengine/plan/parser/ASTVisitor.java     | 12 ++++++----
 4 files changed, 49 insertions(+), 4 deletions(-)

diff --git 
a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IdentifierParser.g4
 
b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IdentifierParser.g4
index fa13e294751..10b2a4cf97f 100644
--- 
a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IdentifierParser.g4
+++ 
b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IdentifierParser.g4
@@ -180,6 +180,8 @@ keyWords
     | PIPESINKTYPE
     | PIPEPLUGIN
     | PIPEPLUGINS
+    | POINT
+    | POINTS
     | POLICY
     | PREVIOUS
     | PREVIOUSUNTILLAST
diff --git 
a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 
b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
index c6271c134cb..3e94667a2fa 100644
--- 
a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
+++ 
b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
@@ -76,6 +76,8 @@ ddlStatement
     | createLogicalView | dropLogicalView | showLogicalView | 
renameLogicalView | alterLogicalView
     // Table View
     | createTableView
+    // for calculation point
+    | createCalcPoint | alterCalcPoint | dropCalcPoint | showCalcPoint
     ;
 
 dmlStatement
@@ -855,6 +857,30 @@ createTableView
         AS prefixPath
     ;
 
+createCalcPoint
+    : CREATE CALCULATION POINT fullPath
+        AS expression
+        STRING_LITERAL
+        comment?
+    ;
+
+alterCalcPoint
+    : ALTER CALCULATION POINT fullPath
+       (AS expression)?
+       (STRING_LITERAL)?
+       comment?
+       (DROP COMMENT)?
+    ;
+
+dropCalcPoint
+    : DROP CALCULATION POINTS prefixPath
+    ;
+
+showCalcPoint
+    : SHOW CALCULATION POINTS prefixPath
+      rowPaginationClause?
+    ;
+
 viewColumnDefinition
     : identifier columnCategory=(TAG | TIME | FIELD) comment?
     | identifier type (columnCategory=(TAG | TIME | FIELD))? comment?
@@ -1484,6 +1510,7 @@ expression
     | leftExpression=expression operator_or rightExpression=expression
     ;
 
+
 caseWhenThenExpression
     : CASE caseExpression=expression? whenThenExpression+ (ELSE 
elseExpression=expression)? END
     ;
diff --git 
a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4 
b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4
index 5c5cbe4a186..59bac72fc78 100644
--- a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4
+++ b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4
@@ -137,6 +137,10 @@ CACHE
     : C A C H E
     ;
 
+CALCULATION
+    : C A L C U L A T I O N
+    ;
+
 CALL
     : C A L L
     ;
@@ -663,6 +667,14 @@ PIPEPLUGINS
     : P I P E P L U G I N S
     ;
 
+POINT
+    : P O I N T
+    ;
+
+POINTS
+    : P O I N T S
+    ;
+
 POLICY
     : P O L I C Y
     ;
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java
index 4a82438b5de..b43e4693d59 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java
@@ -361,6 +361,10 @@ public class ASTVisitor extends 
IoTDBSqlParserBaseVisitor<Statement> {
   public static final String INCORRECT_DATA_TYPE_MSG = "Incorrect Data type";
   private ZoneId zoneId;
 
+  public boolean isUseWildcard() {
+    return useWildcard;
+  }
+
   private boolean useWildcard = false;
 
   private boolean lastLevelUseWildcard = false;
@@ -2390,7 +2394,7 @@ public class ASTVisitor extends 
IoTDBSqlParserBaseVisitor<Statement> {
   /** Common Parsers. */
 
   // IoTDB Objects 
========================================================================
-  private MeasurementPath parseFullPath(IoTDBSqlParser.FullPathContext ctx) {
+  protected MeasurementPath parseFullPath(IoTDBSqlParser.FullPathContext ctx) {
     List<IoTDBSqlParser.NodeNameWithoutWildcardContext> nodeNamesWithoutStar =
         ctx.nodeNameWithoutWildcard();
     String[] path = new String[nodeNamesWithoutStar.size() + 1];
@@ -2421,7 +2425,7 @@ public class ASTVisitor extends 
IoTDBSqlParserBaseVisitor<Statement> {
     return new PartialPath(path);
   }
 
-  private PartialPath parseFullPathInExpression(
+  protected PartialPath parseFullPathInExpression(
       IoTDBSqlParser.FullPathInExpressionContext ctx, boolean canUseFullPath) {
     List<IoTDBSqlParser.NodeNameContext> nodeNames = ctx.nodeName();
     int size = nodeNames.size();
@@ -2465,7 +2469,7 @@ public class ASTVisitor extends 
IoTDBSqlParserBaseVisitor<Statement> {
     return new PartialPath(path);
   }
 
-  private PartialPath parsePrefixPath(IoTDBSqlParser.PrefixPathContext ctx) {
+  protected PartialPath parsePrefixPath(IoTDBSqlParser.PrefixPathContext ctx) {
     List<IoTDBSqlParser.NodeNameContext> nodeNames = ctx.nodeName();
     String[] path = new String[nodeNames.size() + 1];
     path[0] = ctx.ROOT().getText();
@@ -3557,7 +3561,7 @@ public class ASTVisitor extends 
IoTDBSqlParserBaseVisitor<Statement> {
     }
   }
 
-  private Expression parseConstantOperand(ConstantContext constantContext) {
+  protected Expression parseConstantOperand(ConstantContext constantContext) {
     String text = constantContext.getText();
     if (constantContext.boolean_literal() != null) {
       return new ConstantOperand(TSDataType.BOOLEAN, text);

Reply via email to