This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 033180e9cb2 Refactor DistSQLStatementParserEngine. (#19274)
033180e9cb2 is described below
commit 033180e9cb2732ab688a954c86d6ae96948bc47c
Author: Raigor <[email protected]>
AuthorDate: Tue Jul 19 12:55:53 2022 +0800
Refactor DistSQLStatementParserEngine. (#19274)
---
.../imports/{AdvancedKeyword.g4 => RULKeyword.g4} | 2 +-
.../{AdvancedStatement.g4 => RULStatement.g4} | 4 +-
...stSQLStatement.g4 => KernelDistSQLStatement.g4} | 2 +-
...tSQLStatement.g4 => UtilityDistSQLStatement.g4} | 4 +-
.../KernelDistSQLLexer.java} | 10 +-
.../KernelDistSQLParser.java} | 10 +-
.../KernelDistSQLStatementParserEngine.java} | 10 +-
.../KernelDistSQLStatementVisitor.java} | 122 ++++++++++-----------
.../UtilityDistSQLLexer.java} | 10 +-
.../UtilityDistSQLParser.java} | 10 +-
.../UtilityDistSQLStatementParserEngine.java} | 10 +-
.../UtilityDistSQLStatementVisitor.java} | 14 +--
.../engine/api/DistSQLStatementParserEngine.java | 8 +-
13 files changed, 108 insertions(+), 108 deletions(-)
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/AdvancedKeyword.g4
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RULKeyword.g4
similarity index 96%
rename from
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/AdvancedKeyword.g4
rename to
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RULKeyword.g4
index 946d3c5785e..54c18e81d7a 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/AdvancedKeyword.g4
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RULKeyword.g4
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-lexer grammar AdvancedKeyword;
+lexer grammar RULKeyword;
import Alphabet;
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/AdvancedStatement.g4
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RULStatement.g4
similarity index 94%
rename from
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/AdvancedStatement.g4
rename to
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RULStatement.g4
index c04bd31460f..6b1f418b2a8 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/AdvancedStatement.g4
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RULStatement.g4
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-grammar AdvancedStatement;
+grammar RULStatement;
-import AdvancedKeyword;
+import RULKeyword;
previewSQL
: PREVIEW sql
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/CommonDistSQLStatement.g4
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
similarity index 98%
rename from
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/CommonDistSQLStatement.g4
rename to
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
index e6c0bc9ddd3..85c5e312b1d 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/CommonDistSQLStatement.g4
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-grammar CommonDistSQLStatement;
+grammar KernelDistSQLStatement;
import Symbol, RALStatement, RDLStatement, RQLStatement;
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/AdvancedDistSQLStatement.g4
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/UtilityDistSQLStatement.g4
similarity index 92%
rename from
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/AdvancedDistSQLStatement.g4
rename to
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/UtilityDistSQLStatement.g4
index a409ca33f51..9bc6d3cb316 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/AdvancedDistSQLStatement.g4
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/UtilityDistSQLStatement.g4
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-grammar AdvancedDistSQLStatement;
+grammar UtilityDistSQLStatement;
-import Symbol, AdvancedStatement;
+import Symbol, RULStatement;
execute
: (previewSQL
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLLexer.java
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLLexer.java
similarity index 78%
rename from
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLLexer.java
rename to
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLLexer.java
index 58b32d83add..b9aa74f5d53 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLLexer.java
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLLexer.java
@@ -15,18 +15,18 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.distsql.parser.core.common;
+package org.apache.shardingsphere.distsql.parser.core.kernel;
import org.antlr.v4.runtime.CharStream;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementLexer;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementLexer;
import org.apache.shardingsphere.sql.parser.api.parser.SQLLexer;
/**
- * SQL lexer for common dist SQL.
+ * SQL lexer for kernel dist SQL.
*/
-public final class CommonDistSQLLexer extends CommonDistSQLStatementLexer
implements SQLLexer {
+public final class KernelDistSQLLexer extends KernelDistSQLStatementLexer
implements SQLLexer {
- public CommonDistSQLLexer(final CharStream input) {
+ public KernelDistSQLLexer(final CharStream input) {
super(input);
}
}
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLParser.java
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLParser.java
similarity index 82%
rename from
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLParser.java
rename to
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLParser.java
index 9cef9085601..45f485b457d 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLParser.java
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLParser.java
@@ -15,21 +15,21 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.distsql.parser.core.common;
+package org.apache.shardingsphere.distsql.parser.core.kernel;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.TokenStream;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser;
import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
import org.apache.shardingsphere.sql.parser.core.ParseASTNode;
/**
- * SQL parser for common dist SQL.
+ * SQL parser for kernel dist SQL.
*/
-public final class CommonDistSQLParser extends CommonDistSQLStatementParser
implements SQLParser {
+public final class KernelDistSQLParser extends KernelDistSQLStatementParser
implements SQLParser {
- public CommonDistSQLParser(final TokenStream input) {
+ public KernelDistSQLParser(final TokenStream input) {
super(input);
}
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementParserEngine.java
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementParserEngine.java
similarity index 82%
rename from
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementParserEngine.java
rename to
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementParserEngine.java
index fd93ed209d1..999bd5de7b7 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementParserEngine.java
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementParserEngine.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.distsql.parser.core.common;
+package org.apache.shardingsphere.distsql.parser.core.kernel;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
@@ -25,9 +25,9 @@ import
org.apache.shardingsphere.sql.parser.exception.SQLParsingException;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
/**
- * SQL statement parser engine for common dist SQL.
+ * SQL statement parser engine for kernel dist SQL.
*/
-public final class CommonDistSQLStatementParserEngine {
+public final class KernelDistSQLStatementParserEngine {
/**
* Parse SQL.
@@ -36,7 +36,7 @@ public final class CommonDistSQLStatementParserEngine {
* @return SQL statement
*/
public SQLStatement parse(final String sql) {
- ASTNode astNode = SQLParserFactory.newInstance(sql,
CommonDistSQLLexer.class, CommonDistSQLParser.class).parse();
+ ASTNode astNode = SQLParserFactory.newInstance(sql,
KernelDistSQLLexer.class, KernelDistSQLParser.class).parse();
return getSQLStatement(sql, (ParseASTNode) astNode);
}
@@ -44,6 +44,6 @@ public final class CommonDistSQLStatementParserEngine {
if (parseASTNode.getRootNode() instanceof ErrorNode) {
throw new SQLParsingException("Unsupported SQL of `%s`", sql);
}
- return (SQLStatement) (new
CommonDistSQLStatementVisitor()).visit(parseASTNode.getRootNode());
+ return (SQLStatement) (new
KernelDistSQLStatementVisitor()).visit(parseASTNode.getRootNode());
}
}
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementVisitor.java
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
similarity index 85%
rename from
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementVisitor.java
rename to
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
index 2458ba893d5..e656a59a4b2 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementVisitor.java
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
@@ -15,67 +15,67 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.distsql.parser.core.common;
+package org.apache.shardingsphere.distsql.parser.core.kernel;
import org.antlr.v4.runtime.tree.ParseTree;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementBaseVisitor;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.AddResourceContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.AlgorithmDefinitionContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.AlgorithmPropertiesContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.AlgorithmPropertyContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.AlterDefaultSingleTableRuleContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.AlterInstanceContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.AlterResourceContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.AlterSQLParserRuleContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.AlterTrafficRuleContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.AlterTransactionRuleContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ApplyDistSQLContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.CacheOptionContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ClearHintContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.CountDatabaseRulesContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.CountSingleTableRuleContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.CreateDefaultSingleTableRuleContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.CreateTrafficRuleContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.DataSourceContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.DatabaseNameContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.DisableInstanceContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.DiscardDistSQLContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.DropDefaultSingleTableRuleContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.DropResourceContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.DropTrafficRuleContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.EnableInstanceContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ExportDatabaseConfigurationContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.FromSegmentContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ImportDatabaseConfigurationContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.InstanceIdContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.LabelDefinitionContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.LabelInstanceContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.LoadBalancerDefinitionContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.PasswordContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.PrepareDistSQLContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.PropertiesDefinitionContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.PropertyContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ProviderDefinitionContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.RefreshTableMetadataContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.SetVariableContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowAllVariablesContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowAuthorityRuleContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowInstanceContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowInstanceModeContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowResourcesContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowRulesUsedResourceContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowSQLParserRuleContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowSingleTableContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowSingleTableRulesContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowTableMetadataContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowTrafficRulesContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowTransactionRuleContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowUnusedResourcesContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.ShowVariableContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.SqlParserRuleDefinitionContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.TrafficRuleDefinitionContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.TransactionRuleDefinitionContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.CommonDistSQLStatementParser.UnlabelInstanceContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementBaseVisitor;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AddResourceContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AlgorithmDefinitionContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AlgorithmPropertiesContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AlgorithmPropertyContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AlterDefaultSingleTableRuleContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AlterInstanceContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AlterResourceContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AlterSQLParserRuleContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AlterTrafficRuleContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AlterTransactionRuleContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ApplyDistSQLContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.CacheOptionContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ClearHintContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.CountDatabaseRulesContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.CountSingleTableRuleContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.CreateDefaultSingleTableRuleContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.CreateTrafficRuleContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.DataSourceContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.DatabaseNameContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.DisableInstanceContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.DiscardDistSQLContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.DropDefaultSingleTableRuleContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.DropResourceContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.DropTrafficRuleContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.EnableInstanceContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ExportDatabaseConfigurationContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.FromSegmentContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ImportDatabaseConfigurationContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.InstanceIdContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.LabelDefinitionContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.LabelInstanceContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.LoadBalancerDefinitionContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.PasswordContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.PrepareDistSQLContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.PropertiesDefinitionContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.PropertyContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ProviderDefinitionContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.RefreshTableMetadataContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.SetVariableContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowAllVariablesContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowAuthorityRuleContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowInstanceContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowInstanceModeContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowResourcesContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowRulesUsedResourceContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowSQLParserRuleContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowSingleTableContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowSingleTableRulesContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowTableMetadataContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowTrafficRulesContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowTransactionRuleContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowUnusedResourcesContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowVariableContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.SqlParserRuleDefinitionContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.TrafficRuleDefinitionContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.TransactionRuleDefinitionContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.UnlabelInstanceContext;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.distsql.parser.segment.CacheOptionSegment;
import org.apache.shardingsphere.distsql.parser.segment.DataSourceSegment;
@@ -132,9 +132,9 @@ import java.util.Properties;
import java.util.stream.Collectors;
/**
- * SQL statement visitor for common dist SQL.
+ * SQL statement visitor for kernel dist SQL.
*/
-public final class CommonDistSQLStatementVisitor extends
CommonDistSQLStatementBaseVisitor<ASTNode> implements SQLVisitor {
+public final class KernelDistSQLStatementVisitor extends
KernelDistSQLStatementBaseVisitor<ASTNode> implements SQLVisitor {
@Override
public ASTNode visitAddResource(final AddResourceContext ctx) {
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/advanced/AdvancedDistSQLLexer.java
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/utility/UtilityDistSQLLexer.java
similarity index 73%
rename from
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/advanced/AdvancedDistSQLLexer.java
rename to
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/utility/UtilityDistSQLLexer.java
index b269c22ef2d..2e9e1147ac0 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/advanced/AdvancedDistSQLLexer.java
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/utility/UtilityDistSQLLexer.java
@@ -15,18 +15,18 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.distsql.parser.core.advanced;
+package org.apache.shardingsphere.distsql.parser.core.utility;
import org.antlr.v4.runtime.CharStream;
-import
org.apache.shardingsphere.distsql.parser.autogen.AdvancedDistSQLStatementLexer;
+import
org.apache.shardingsphere.distsql.parser.autogen.UtilityDistSQLStatementLexer;
import org.apache.shardingsphere.sql.parser.api.parser.SQLLexer;
/**
- * SQL lexer for advanced dist SQL.
+ * SQL lexer for utility dist SQL.
*/
-public final class AdvancedDistSQLLexer extends AdvancedDistSQLStatementLexer
implements SQLLexer {
+public final class UtilityDistSQLLexer extends UtilityDistSQLStatementLexer
implements SQLLexer {
- public AdvancedDistSQLLexer(final CharStream input) {
+ public UtilityDistSQLLexer(final CharStream input) {
super(input);
}
}
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/advanced/AdvancedDistSQLParser.java
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/utility/UtilityDistSQLParser.java
similarity index 78%
rename from
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/advanced/AdvancedDistSQLParser.java
rename to
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/utility/UtilityDistSQLParser.java
index 6140271bb04..0c5e954a513 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/advanced/AdvancedDistSQLParser.java
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/utility/UtilityDistSQLParser.java
@@ -15,21 +15,21 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.distsql.parser.core.advanced;
+package org.apache.shardingsphere.distsql.parser.core.utility;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.TokenStream;
-import
org.apache.shardingsphere.distsql.parser.autogen.AdvancedDistSQLStatementParser;
+import
org.apache.shardingsphere.distsql.parser.autogen.UtilityDistSQLStatementParser;
import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
import org.apache.shardingsphere.sql.parser.core.ParseASTNode;
/**
- * SQL parser for advanced dist SQL.
+ * SQL parser for utility dist SQL.
*/
-public final class AdvancedDistSQLParser extends
AdvancedDistSQLStatementParser implements SQLParser {
+public final class UtilityDistSQLParser extends UtilityDistSQLStatementParser
implements SQLParser {
- public AdvancedDistSQLParser(final TokenStream input) {
+ public UtilityDistSQLParser(final TokenStream input) {
super(input);
}
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/advanced/AdvancedDistSQLStatementParserEngine.java
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/utility/UtilityDistSQLStatementParserEngine.java
similarity index 83%
rename from
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/advanced/AdvancedDistSQLStatementParserEngine.java
rename to
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/utility/UtilityDistSQLStatementParserEngine.java
index 3c642f5fbbb..593f7a169d5 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/advanced/AdvancedDistSQLStatementParserEngine.java
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/utility/UtilityDistSQLStatementParserEngine.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.distsql.parser.core.advanced;
+package org.apache.shardingsphere.distsql.parser.core.utility;
import org.antlr.v4.runtime.misc.ParseCancellationException;
import org.antlr.v4.runtime.tree.ErrorNode;
@@ -26,9 +26,9 @@ import
org.apache.shardingsphere.sql.parser.exception.SQLParsingException;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
/**
- * SQL statement parser engine for advanced dist SQL.
+ * SQL statement parser engine for utility dist SQL.
*/
-public final class AdvancedDistSQLStatementParserEngine {
+public final class UtilityDistSQLStatementParserEngine {
/**
* Parse SQL.
@@ -43,7 +43,7 @@ public final class AdvancedDistSQLStatementParserEngine {
private ASTNode parseToASTNode(final String sql) {
try {
- return SQLParserFactory.newInstance(sql,
AdvancedDistSQLLexer.class, AdvancedDistSQLParser.class).parse();
+ return SQLParserFactory.newInstance(sql,
UtilityDistSQLLexer.class, UtilityDistSQLParser.class).parse();
} catch (final ParseCancellationException | SQLParsingException
ignored) {
throw new SQLParsingException("You have an error in your SQL
syntax.");
}
@@ -53,6 +53,6 @@ public final class AdvancedDistSQLStatementParserEngine {
if (parseASTNode.getRootNode() instanceof ErrorNode) {
throw new SQLParsingException("Unsupported SQL of `%s`", sql);
}
- return (SQLStatement) (new
AdvancedDistSQLStatementVisitor()).visit(parseASTNode.getRootNode());
+ return (SQLStatement) (new
UtilityDistSQLStatementVisitor()).visit(parseASTNode.getRootNode());
}
}
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/advanced/AdvancedDistSQLStatementVisitor.java
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/utility/UtilityDistSQLStatementVisitor.java
similarity index 72%
rename from
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/advanced/AdvancedDistSQLStatementVisitor.java
rename to
shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/utility/UtilityDistSQLStatementVisitor.java
index 7e7fe13e6fe..13d73de72f6 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/advanced/AdvancedDistSQLStatementVisitor.java
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/utility/UtilityDistSQLStatementVisitor.java
@@ -15,12 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.distsql.parser.core.advanced;
+package org.apache.shardingsphere.distsql.parser.core.utility;
-import
org.apache.shardingsphere.distsql.parser.autogen.AdvancedDistSQLStatementBaseVisitor;
-import
org.apache.shardingsphere.distsql.parser.autogen.AdvancedDistSQLStatementParser.FormatSQLContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.AdvancedDistSQLStatementParser.ParseSQLContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.AdvancedDistSQLStatementParser.PreviewSQLContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.UtilityDistSQLStatementBaseVisitor;
+import
org.apache.shardingsphere.distsql.parser.autogen.UtilityDistSQLStatementParser.FormatSQLContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.UtilityDistSQLStatementParser.ParseSQLContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.UtilityDistSQLStatementParser.PreviewSQLContext;
import
org.apache.shardingsphere.distsql.parser.statement.ral.advanced.FormatStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.advanced.ParseStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.advanced.PreviewStatement;
@@ -28,9 +28,9 @@ import
org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
/**
- * SQL statement visitor for advanced dist SQL.
+ * SQL statement visitor for utility dist SQL.
*/
-public final class AdvancedDistSQLStatementVisitor extends
AdvancedDistSQLStatementBaseVisitor<ASTNode> implements SQLVisitor {
+public final class UtilityDistSQLStatementVisitor extends
UtilityDistSQLStatementBaseVisitor<ASTNode> implements SQLVisitor {
@Override
public ASTNode visitPreviewSQL(final PreviewSQLContext ctx) {
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/engine/api/DistSQLStatementParserEngine.java
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/engine/api/DistSQLStatementParserEngine.java
index 472e56558e9..6b9b83f71f3 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/engine/api/DistSQLStatementParserEngine.java
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/engine/api/DistSQLStatementParserEngine.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.distsql.parser.engine.api;
import org.antlr.v4.runtime.misc.ParseCancellationException;
-import
org.apache.shardingsphere.distsql.parser.core.advanced.AdvancedDistSQLStatementParserEngine;
-import
org.apache.shardingsphere.distsql.parser.core.common.CommonDistSQLStatementParserEngine;
+import
org.apache.shardingsphere.distsql.parser.core.utility.UtilityDistSQLStatementParserEngine;
+import
org.apache.shardingsphere.distsql.parser.core.kernel.KernelDistSQLStatementParserEngine;
import
org.apache.shardingsphere.distsql.parser.core.featured.FeaturedDistSQLStatementParserEngine;
import org.apache.shardingsphere.sql.parser.exception.SQLParsingException;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
@@ -37,12 +37,12 @@ public final class DistSQLStatementParserEngine {
*/
public SQLStatement parse(final String sql) {
try {
- return new CommonDistSQLStatementParserEngine().parse(sql);
+ return new KernelDistSQLStatementParserEngine().parse(sql);
} catch (final ParseCancellationException | SQLParsingException
ignored) {
try {
return new FeaturedDistSQLStatementParserEngine().parse(sql);
} catch (SQLParsingException ignoredToo) {
- return new AdvancedDistSQLStatementParserEngine().parse(sql);
+ return new UtilityDistSQLStatementParserEngine().parse(sql);
}
}
}