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

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

commit d39cbac2d6450afcb0eeb0dae9ca5c697492c40b
Author: Minghui Liu <[email protected]>
AuthorDate: Mon Oct 31 11:00:12 2022 +0800

    [IOTDB-4748] Give `STORAGE GROUP` another name: `DATABASE`
---
 .../antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4  | 16 ++++++----------
 .../main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4   |  8 ++++++++
 .../org/apache/iotdb/db/mpp/plan/parser/ASTVisitor.java  | 13 -------------
 3 files changed, 14 insertions(+), 23 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 2a8abb67ea..cd1d4da136 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
@@ -36,8 +36,7 @@ statement
     ;
 
 ddlStatement
-    : setStorageGroup | createStorageGroup | createTimeseries
-    | createSchemaTemplate | createTimeseriesOfSchemaTemplate
+    : createStorageGroup | createTimeseries | createSchemaTemplate | 
createTimeseriesOfSchemaTemplate
     | createFunction | createTrigger | createContinuousQuery
     | alterTimeseries | deleteStorageGroup | deleteTimeseries | 
deletePartition | deleteTimeseriesOfSchemaTemplate
     | dropFunction | dropTrigger | dropContinuousQuery | dropSchemaTemplate
@@ -74,12 +73,9 @@ syncStatement
  */
 
 // Create Storage Group
-setStorageGroup
-    : SET STORAGE GROUP TO prefixPath storageGroupAttributesClause?
-    ;
-
 createStorageGroup
-    : CREATE STORAGE GROUP prefixPath storageGroupAttributesClause?
+    : SET STORAGE GROUP TO prefixPath storageGroupAttributesClause?
+    | CREATE (STORAGE GROUP | DATABASE) prefixPath 
storageGroupAttributesClause?
     ;
 
 storageGroupAttributesClause
@@ -197,7 +193,7 @@ alias
 
 // Delete Storage Group
 deleteStorageGroup
-    : DELETE STORAGE GROUP prefixPath (COMMA prefixPath)*
+    : (DELETE | DROP) (STORAGE GROUP | DATABASE) prefixPath (COMMA prefixPath)*
     ;
 
 // Delete Timeseries
@@ -285,7 +281,7 @@ stopTrigger
 
 // Show Storage Group
 showStorageGroup
-    : SHOW STORAGE GROUP prefixPath?
+    : SHOW (STORAGE GROUP | DATABASES) prefixPath?
     ;
 
 // Show Devices
@@ -375,7 +371,7 @@ showPathsUsingSchemaTemplate
 
 // Count Storage Group
 countStorageGroup
-    : COUNT STORAGE GROUP prefixPath?
+    : COUNT (STORAGE GROUP | DATABASES) prefixPath?
     ;
 
 // Count Devices
diff --git a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4 
b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4
index 225f1563e1..a6141a614e 100644
--- a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4
+++ b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4
@@ -161,6 +161,14 @@ DATA
     : D A T A
     ;
 
+DATABASE
+    : D A T A B A S E
+    ;
+
+DATABASES
+    : D A T A B A S E S
+    ;
+
 DATANODES
 
     : D A T A N O D E S
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/ASTVisitor.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/ASTVisitor.java
index 72d68f36e3..0c5eaf8ad0 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/ASTVisitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/ASTVisitor.java
@@ -2149,19 +2149,6 @@ public class ASTVisitor extends 
IoTDBSqlParserBaseVisitor<Statement> {
   }
 
   // Create Storage Group
-
-  @Override
-  public Statement visitSetStorageGroup(IoTDBSqlParser.SetStorageGroupContext 
ctx) {
-    SetStorageGroupStatement setStorageGroupStatement = new 
SetStorageGroupStatement();
-    PartialPath path = parsePrefixPath(ctx.prefixPath());
-    setStorageGroupStatement.setStorageGroupPath(path);
-    if (ctx.storageGroupAttributesClause() != null) {
-      parseStorageGroupAttributesClause(
-          setStorageGroupStatement, ctx.storageGroupAttributesClause());
-    }
-    return setStorageGroupStatement;
-  }
-
   @Override
   public Statement 
visitCreateStorageGroup(IoTDBSqlParser.CreateStorageGroupContext ctx) {
     SetStorageGroupStatement setStorageGroupStatement = new 
SetStorageGroupStatement();

Reply via email to