diff --git a/features/broadcast/distsql/parser/src/main/java/org/apache/shardingsphere/broadcast/distsql/parser/facade/BroadcastDistSQLParserFacade.java b/features/broadcast/distsql/parser/src/main/java/org/apache/shardingsphere/broadcast/distsql/parser/facade/BroadcastDistSQLParserFacade.java index 4316e004a7c12..0cd12b7f74d48 100644 --- a/features/broadcast/distsql/parser/src/main/java/org/apache/shardingsphere/broadcast/distsql/parser/facade/BroadcastDistSQLParserFacade.java +++ b/features/broadcast/distsql/parser/src/main/java/org/apache/shardingsphere/broadcast/distsql/parser/facade/BroadcastDistSQLParserFacade.java @@ -45,9 +45,4 @@ public Class getParserClass() { public Class> getVisitorClass() { return BroadcastDistSQLStatementVisitor.class; } - - @Override - public String getType() { - return "broadcast"; - } } diff --git a/features/encrypt/distsql/parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/facade/EncryptDistSQLParserFacade.java b/features/encrypt/distsql/parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/facade/EncryptDistSQLParserFacade.java index ab98b9054b073..e7e266214de6c 100644 --- a/features/encrypt/distsql/parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/facade/EncryptDistSQLParserFacade.java +++ b/features/encrypt/distsql/parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/facade/EncryptDistSQLParserFacade.java @@ -45,9 +45,4 @@ public Class getParserClass() { public Class> getVisitorClass() { return EncryptDistSQLStatementVisitor.class; } - - @Override - public String getType() { - return "encrypt"; - } } diff --git a/features/mask/distsql/parser/src/main/java/org/apache/shardingsphere/mask/distsql/parser/facade/MaskDistSQLParserFacade.java b/features/mask/distsql/parser/src/main/java/org/apache/shardingsphere/mask/distsql/parser/facade/MaskDistSQLParserFacade.java index ec366dd944a40..af025b348fd30 100644 --- a/features/mask/distsql/parser/src/main/java/org/apache/shardingsphere/mask/distsql/parser/facade/MaskDistSQLParserFacade.java +++ b/features/mask/distsql/parser/src/main/java/org/apache/shardingsphere/mask/distsql/parser/facade/MaskDistSQLParserFacade.java @@ -45,9 +45,4 @@ public Class getParserClass() { public Class> getVisitorClass() { return MaskDistSQLStatementVisitor.class; } - - @Override - public String getType() { - return "mask"; - } } diff --git a/features/readwrite-splitting/distsql/parser/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/facade/ReadwriteSplittingDistSQLParserFacade.java b/features/readwrite-splitting/distsql/parser/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/facade/ReadwriteSplittingDistSQLParserFacade.java index cdfa2d47bc2db..580339c374060 100644 --- a/features/readwrite-splitting/distsql/parser/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/facade/ReadwriteSplittingDistSQLParserFacade.java +++ b/features/readwrite-splitting/distsql/parser/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/facade/ReadwriteSplittingDistSQLParserFacade.java @@ -45,9 +45,4 @@ public Class getParserClass() { public Class> getVisitorClass() { return ReadwriteSplittingDistSQLStatementVisitor.class; } - - @Override - public String getType() { - return "readwrite-splitting"; - } } diff --git a/features/shadow/distsql/parser/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/facade/ShadowDistSQLParserFacade.java b/features/shadow/distsql/parser/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/facade/ShadowDistSQLParserFacade.java index 969511f5f13ba..f95221712a5ba 100644 --- a/features/shadow/distsql/parser/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/facade/ShadowDistSQLParserFacade.java +++ b/features/shadow/distsql/parser/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/facade/ShadowDistSQLParserFacade.java @@ -45,9 +45,4 @@ public Class getParserClass() { public Class> getVisitorClass() { return ShadowDistSQLStatementVisitor.class; } - - @Override - public String getType() { - return "shadow"; - } } diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java index e91abf35d34bf..c4ec40b2cb232 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java @@ -18,17 +18,15 @@ package org.apache.shardingsphere.sharding.distsql.update; import lombok.SneakyThrows; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.DistSQLException; -import org.apache.shardingsphere.distsql.parser.engine.spi.DistSQLParserFacade; import org.apache.shardingsphere.distsql.segment.AlgorithmSegment; import org.apache.shardingsphere.distsql.statement.DistSQLStatement; import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration; import org.apache.shardingsphere.infra.config.rule.RuleConfiguration; +import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.DistSQLException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule; -import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration; import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration; import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration; @@ -290,7 +288,7 @@ private Map createDataSource() { private DistSQLStatement getDistSQLStatement(final String sql) { ShardingDistSQLParserFacade facade = new ShardingDistSQLParserFacade(); ParseASTNode parseASTNode = (ParseASTNode) SQLParserFactory.newInstance(sql, facade.getLexerClass(), facade.getParserClass()).parse(); - SQLVisitor visitor = TypedSPILoader.getService(DistSQLParserFacade.class, facade.getType()).getVisitorClass().getDeclaredConstructor().newInstance(); + SQLVisitor visitor = facade.getVisitorClass().getDeclaredConstructor().newInstance(); return (DistSQLStatement) visitor.visit(parseASTNode.getRootNode()); } diff --git a/features/sharding/distsql/parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/facade/ShardingDistSQLParserFacade.java b/features/sharding/distsql/parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/facade/ShardingDistSQLParserFacade.java index 242eb87bbff2f..8777b3dfcfa7a 100644 --- a/features/sharding/distsql/parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/facade/ShardingDistSQLParserFacade.java +++ b/features/sharding/distsql/parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/facade/ShardingDistSQLParserFacade.java @@ -45,9 +45,4 @@ public Class getParserClass() { public Class> getVisitorClass() { return ShardingDistSQLStatementVisitor.class; } - - @Override - public String getType() { - return "sharding"; - } } diff --git a/kernel/authority/distsql/parser/src/main/java/org/apache/shardingsphere/authority/distsql/parser/facade/AuthorityDistSQLParserFacade.java b/kernel/authority/distsql/parser/src/main/java/org/apache/shardingsphere/authority/distsql/parser/facade/AuthorityDistSQLParserFacade.java index e348627f1d792..c085d6cc991b9 100644 --- a/kernel/authority/distsql/parser/src/main/java/org/apache/shardingsphere/authority/distsql/parser/facade/AuthorityDistSQLParserFacade.java +++ b/kernel/authority/distsql/parser/src/main/java/org/apache/shardingsphere/authority/distsql/parser/facade/AuthorityDistSQLParserFacade.java @@ -45,9 +45,4 @@ public Class getParserClass() { public Class> getVisitorClass() { return AuthorityDistSQLStatementVisitor.class; } - - @Override - public String getType() { - return "authority"; - } } diff --git a/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/parser/facade/CDCDistSQLParserFacade.java b/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/parser/facade/CDCDistSQLParserFacade.java index 1a4681e596458..c8216720ea582 100644 --- a/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/parser/facade/CDCDistSQLParserFacade.java +++ b/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/parser/facade/CDCDistSQLParserFacade.java @@ -45,9 +45,4 @@ public Class getParserClass() { public Class> getVisitorClass() { return CDCDistSQLStatementVisitor.class; } - - @Override - public String getType() { - return "CDC"; - } } diff --git a/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/parser/facade/MigrationDistSQLParserFacade.java b/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/parser/facade/MigrationDistSQLParserFacade.java index 4269c12869c2c..93f3a2ed3bbe0 100644 --- a/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/parser/facade/MigrationDistSQLParserFacade.java +++ b/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/parser/facade/MigrationDistSQLParserFacade.java @@ -45,9 +45,4 @@ public Class getParserClass() { public Class> getVisitorClass() { return MigrationDistSQLStatementVisitor.class; } - - @Override - public String getType() { - return "migration"; - } } diff --git a/kernel/global-clock/distsql/parser/src/main/java/org/apache/shardingsphere/globalclock/distsql/parser/facade/GlobalClockDistSQLParserFacade.java b/kernel/global-clock/distsql/parser/src/main/java/org/apache/shardingsphere/globalclock/distsql/parser/facade/GlobalClockDistSQLParserFacade.java index 294dc0846c1b3..196b3d8d13f92 100644 --- a/kernel/global-clock/distsql/parser/src/main/java/org/apache/shardingsphere/globalclock/distsql/parser/facade/GlobalClockDistSQLParserFacade.java +++ b/kernel/global-clock/distsql/parser/src/main/java/org/apache/shardingsphere/globalclock/distsql/parser/facade/GlobalClockDistSQLParserFacade.java @@ -45,9 +45,4 @@ public Class getParserClass() { public Class> getVisitorClass() { return GlobalClockDistSQLStatementVisitor.class; } - - @Override - public String getType() { - return "global_clock"; - } } diff --git a/kernel/single/distsql/parser/src/main/java/org/apache/shardingsphere/single/distsql/parser/facade/SingleDistSQLParserFacade.java b/kernel/single/distsql/parser/src/main/java/org/apache/shardingsphere/single/distsql/parser/facade/SingleDistSQLParserFacade.java index 81d9c52200849..c572f01499253 100644 --- a/kernel/single/distsql/parser/src/main/java/org/apache/shardingsphere/single/distsql/parser/facade/SingleDistSQLParserFacade.java +++ b/kernel/single/distsql/parser/src/main/java/org/apache/shardingsphere/single/distsql/parser/facade/SingleDistSQLParserFacade.java @@ -45,9 +45,4 @@ public Class getParserClass() { public Class> getVisitorClass() { return SingleDistSQLStatementVisitor.class; } - - @Override - public String getType() { - return "single"; - } } diff --git a/kernel/sql-federation/distsql/parser/src/main/java/org/apache/shardingsphere/sqlfederation/distsql/parser/facade/SQLFederationDistSQLParserFacade.java b/kernel/sql-federation/distsql/parser/src/main/java/org/apache/shardingsphere/sqlfederation/distsql/parser/facade/SQLFederationDistSQLParserFacade.java index 61ebda33e0552..e9a51e207b482 100644 --- a/kernel/sql-federation/distsql/parser/src/main/java/org/apache/shardingsphere/sqlfederation/distsql/parser/facade/SQLFederationDistSQLParserFacade.java +++ b/kernel/sql-federation/distsql/parser/src/main/java/org/apache/shardingsphere/sqlfederation/distsql/parser/facade/SQLFederationDistSQLParserFacade.java @@ -45,9 +45,4 @@ public Class getParserClass() { public Class> getVisitorClass() { return SQLFederationDistSQLStatementVisitor.class; } - - @Override - public String getType() { - return "sql_federation"; - } } diff --git a/kernel/sql-parser/distsql/parser/src/main/java/org/apache/shardingsphere/parser/distsql/parser/facade/SQLParserDistSQLParserFacade.java b/kernel/sql-parser/distsql/parser/src/main/java/org/apache/shardingsphere/parser/distsql/parser/facade/SQLParserDistSQLParserFacade.java index f1f85f2f2647e..813340263ae8b 100644 --- a/kernel/sql-parser/distsql/parser/src/main/java/org/apache/shardingsphere/parser/distsql/parser/facade/SQLParserDistSQLParserFacade.java +++ b/kernel/sql-parser/distsql/parser/src/main/java/org/apache/shardingsphere/parser/distsql/parser/facade/SQLParserDistSQLParserFacade.java @@ -45,9 +45,4 @@ public Class getParserClass() { public Class> getVisitorClass() { return SQLParserDistSQLStatementVisitor.class; } - - @Override - public String getType() { - return "sql_parser"; - } } diff --git a/kernel/sql-translator/distsql/parser/src/main/java/org/apache/shardingsphere/sqltranslator/distsql/parser/facade/SQLTranslatorDistSQLParserFacade.java b/kernel/sql-translator/distsql/parser/src/main/java/org/apache/shardingsphere/sqltranslator/distsql/parser/facade/SQLTranslatorDistSQLParserFacade.java index 0e3529d2d0310..4f876d394b4cd 100644 --- a/kernel/sql-translator/distsql/parser/src/main/java/org/apache/shardingsphere/sqltranslator/distsql/parser/facade/SQLTranslatorDistSQLParserFacade.java +++ b/kernel/sql-translator/distsql/parser/src/main/java/org/apache/shardingsphere/sqltranslator/distsql/parser/facade/SQLTranslatorDistSQLParserFacade.java @@ -45,9 +45,4 @@ public Class getParserClass() { public Class> getVisitorClass() { return SQLTranslatorDistSQLStatementVisitor.class; } - - @Override - public String getType() { - return "sql_translator"; - } } diff --git a/kernel/traffic/distsql/parser/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/facade/TrafficDistSQLParserFacade.java b/kernel/traffic/distsql/parser/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/facade/TrafficDistSQLParserFacade.java index 833bab02f4cce..986a6a314c37c 100644 --- a/kernel/traffic/distsql/parser/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/facade/TrafficDistSQLParserFacade.java +++ b/kernel/traffic/distsql/parser/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/facade/TrafficDistSQLParserFacade.java @@ -45,9 +45,4 @@ public Class getParserClass() { public Class> getVisitorClass() { return TrafficDistSQLStatementVisitor.class; } - - @Override - public String getType() { - return "traffic"; - } } diff --git a/kernel/transaction/distsql/parser/src/main/java/org/apache/shardingsphere/transaction/distsql/parser/facade/TransactionDistSQLParserFacade.java b/kernel/transaction/distsql/parser/src/main/java/org/apache/shardingsphere/transaction/distsql/parser/facade/TransactionDistSQLParserFacade.java index fd33a7b673d68..29ff6a7ad1d24 100644 --- a/kernel/transaction/distsql/parser/src/main/java/org/apache/shardingsphere/transaction/distsql/parser/facade/TransactionDistSQLParserFacade.java +++ b/kernel/transaction/distsql/parser/src/main/java/org/apache/shardingsphere/transaction/distsql/parser/facade/TransactionDistSQLParserFacade.java @@ -45,9 +45,4 @@ public Class getParserClass() { public Class> getVisitorClass() { return TransactionDistSQLStatementVisitor.class; } - - @Override - public String getType() { - return "transaction"; - } } diff --git a/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/featured/FeaturedDistSQLStatementParserEngine.java b/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/featured/DistSQLParserEngine.java similarity index 96% rename from parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/featured/FeaturedDistSQLStatementParserEngine.java rename to parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/featured/DistSQLParserEngine.java index 9955ca01d1b0c..4c5bab610f959 100644 --- a/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/featured/FeaturedDistSQLStatementParserEngine.java +++ b/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/featured/DistSQLParserEngine.java @@ -29,9 +29,9 @@ import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement; /** - * Featured DistSQL statement parser engine. + * DistSQL parser engine. */ -public final class FeaturedDistSQLStatementParserEngine { +public final class DistSQLParserEngine { /** * Parse SQL. diff --git a/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/engine/api/DistSQLStatementParserEngine.java b/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/engine/api/DistSQLStatementParserEngine.java index 3bd13c030aadd..3f15586aec928 100644 --- a/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/engine/api/DistSQLStatementParserEngine.java +++ b/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/engine/api/DistSQLStatementParserEngine.java @@ -20,7 +20,7 @@ import org.antlr.v4.runtime.misc.ParseCancellationException; 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.distsql.parser.core.featured.DistSQLParserEngine; import org.apache.shardingsphere.sql.parser.exception.SQLParsingException; import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement; @@ -40,7 +40,7 @@ public SQLStatement parse(final String sql) { return new KernelDistSQLStatementParserEngine().parse(sql); } catch (final ParseCancellationException | SQLParsingException ignored) { try { - return new FeaturedDistSQLStatementParserEngine().parse(sql); + return new DistSQLParserEngine().parse(sql); } catch (final SQLParsingException ignoredToo) { return new UtilityDistSQLStatementParserEngine().parse(sql); } diff --git a/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/engine/spi/DistSQLParserFacade.java b/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/engine/spi/DistSQLParserFacade.java index 13026a20df3ef..a142b02c4e6a7 100644 --- a/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/engine/spi/DistSQLParserFacade.java +++ b/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/engine/spi/DistSQLParserFacade.java @@ -18,7 +18,6 @@ package org.apache.shardingsphere.distsql.parser.engine.spi; import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI; -import org.apache.shardingsphere.infra.spi.type.typed.TypedSPI; import org.apache.shardingsphere.sql.parser.api.ASTNode; import org.apache.shardingsphere.sql.parser.api.parser.SQLLexer; import org.apache.shardingsphere.sql.parser.api.parser.SQLParser; @@ -28,7 +27,7 @@ * DistSQL parser facade. */ @SingletonSPI -public interface DistSQLParserFacade extends TypedSPI { +public interface DistSQLParserFacade { /** * Get SQL lexer class type. @@ -50,7 +49,4 @@ public interface DistSQLParserFacade extends TypedSPI { * @return visitor class */ Class> getVisitorClass(); - - @Override - String getType(); }