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/03/14 01:51:59 UTC
[iotdb] 04/11: add model management SQL in g4
This is an automated email from the ASF dual-hosted git repository.
hui pushed a commit to branch lmh/MLSQL
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 8eb161efc31be7ed79bfc6207b1dbabc979b8997
Author: Minghui Liu <li...@foxmail.com>
AuthorDate: Tue Feb 28 09:47:33 2023 +0800
add model management SQL in g4
---
.../org/apache/iotdb/db/qp/sql/IdentifierParser.g4 | 4 ++++
.../org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 | 27 ++++++++++++++++++++++
.../antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4 | 16 +++++++++++++
3 files changed, 47 insertions(+)
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 5889464db9..3c0e7a4a79 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
@@ -43,6 +43,7 @@ keyWords
| AS
| ASC
| ATTRIBUTES
+ | AUTO
| BEFORE
| BEGIN
| BLOCKED
@@ -114,6 +115,8 @@ keyWords
| LOCK
| MERGE
| METADATA
+ | MODEL
+ | MODELS
| NODES
| NONE
| NOW
@@ -181,6 +184,7 @@ keyWords
| TOLERANCE
| TOP
| TRACING
+ | TRAILS
| TRIGGER
| TRIGGERS
| TTL
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 0f4cc68b6a..82200e9e78 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
@@ -56,6 +56,8 @@ ddlStatement
// Cluster
| showVariables | showCluster | showRegions | showDataNodes | showConfigNodes
| getRegionId | getTimeSlotList | getSeriesSlotList | migrateRegion
+ // ML Model
+ | createModel | dropModel | showModels | showTrails
;
dmlStatement
@@ -446,6 +448,31 @@ migrateRegion
;
+// ML Model =========================================================================================
+// ---- Create Model
+createModel
+ : CREATE AUTO? MODEL modelId=identifier
+ WITH attributePair (COMMA attributePair)*
+ BEGIN
+ selectStatement
+ END
+ ;
+
+// ---- Drop Model
+dropModel
+ : DROP MODEL modelId=identifier
+ ;
+
+// ---- Show Models
+showModels
+ : SHOW MODELS
+ ;
+
+// ---- Show Trails
+showTrails
+ : SHOW TRAILS
+ ;
+
/**
* 3. Data Manipulation Language (DML)
*/
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 24ba612b93..f06d70e318 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
@@ -85,6 +85,10 @@ ATTRIBUTES
: A T T R I B U T E S
;
+AUTO
+ : A U T O
+ ;
+
BEFORE
: B E F O R E
;
@@ -382,6 +386,14 @@ MIGRATE
: M I G R A T E
;
+MODEL
+ : M O D E L
+ ;
+
+MODELS
+ : M O D E L S
+ ;
+
NODEID
: N O D E I D
;
@@ -674,6 +686,10 @@ TRACING
: T R A C I N G
;
+TRAILS
+ : T R A I L S
+ ;
+
TRIGGER
: T R I G G E R
;