This is an automated email from the ASF dual-hosted git repository.
panjuan 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 34b69b8749b Refactor DistSQLExecutorRuleAware (#29874)
34b69b8749b is described below
commit 34b69b8749b24ffe6b4538ec69b1985e33ed7030
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Jan 27 19:23:13 2024 +0800
Refactor DistSQLExecutorRuleAware (#29874)
* Rename DistSQLExecutorConnectionSizeAware
* Refactor DistSQLExecutorRuleAware
* Refactor DistSQLExecutorRuleAware
---
.../query/ShowBroadcastTableRuleExecutor.java | 4 +-
.../handler/query/ShowEncryptRuleExecutor.java | 4 +-
.../handler/query/ShowMaskRuleExecutor.java | 4 +-
.../query/ShowReadwriteSplittingRuleExecutor.java | 4 +-
.../query/ShowDefaultShadowAlgorithmExecutor.java | 4 +-
.../query/ShowShadowAlgorithmsExecutor.java | 4 +-
.../handler/query/ShowShadowRuleExecutor.java | 4 +-
.../query/ShowShadowTableRulesExecutor.java | 4 +-
.../query/ShowDefaultShardingStrategyExecutor.java | 4 +-
.../query/ShowShardingAlgorithmExecutor.java | 4 +-
.../query/ShowShardingAuditorsExecutor.java | 4 +-
.../query/ShowShardingKeyGeneratorExecutor.java | 4 +-
.../query/ShowShardingTableNodesExecutor.java | 4 +-
.../ShowShardingTableReferenceRuleExecutor.java | 4 +-
.../query/ShowShardingTableRuleExecutor.java | 4 +-
...howShardingTableRulesUsedAlgorithmExecutor.java | 4 +-
.../ShowShardingTableRulesUsedAuditorExecutor.java | 4 +-
...ShardingTableRulesUsedKeyGeneratorExecutor.java | 4 +-
.../ShowUnusedShardingAlgorithmsExecutor.java | 4 +-
.../query/ShowUnusedShardingAuditorsExecutor.java | 4 +-
.../ShowUnusedShardingKeyGeneratorExecutor.java | 4 +-
.../aware/DistSQLExecutorConnectionSizeAware.java | 2 +-
.../DistSQLExecutorRuleAware.java} | 14 ++-----
.../distsql/handler/type/rql/RQLExecuteEngine.java | 45 +++++++++++-----------
.../type/rql/aware/GlobalRuleAwareRQLExecutor.java | 45 ----------------------
.../distsql/handler/ShowAuthorityRuleExecutor.java | 5 ++-
.../handler/query/ShowGlobalClockRuleExecutor.java | 5 ++-
.../ShowDefaultSingleTableStorageUnitExecutor.java | 4 +-
.../handler/query/ShowSingleTableExecutor.java | 4 +-
.../query/ShowUnloadedSingleTableExecutor.java | 5 ++-
.../query/ShowSQLFederationRuleExecutor.java | 5 ++-
.../handler/query/ShowSQLParserRuleExecutor.java | 5 ++-
.../query/ShowSQLTranslatorRuleExecutor.java | 5 ++-
.../handler/query/ShowTrafficRuleExecutor.java | 5 ++-
.../handler/query/ShowTransactionRuleExecutor.java | 5 ++-
35 files changed, 97 insertions(+), 141 deletions(-)
diff --git
a/features/broadcast/distsql/handler/src/main/java/org/apache/shardingsphere/broadcast/distsql/handler/query/ShowBroadcastTableRuleExecutor.java
b/features/broadcast/distsql/handler/src/main/java/org/apache/shardingsphere/broadcast/distsql/handler/query/ShowBroadcastTableRuleExecutor.java
index 91b2c4e418c..e295d6fb343 100644
---
a/features/broadcast/distsql/handler/src/main/java/org/apache/shardingsphere/broadcast/distsql/handler/query/ShowBroadcastTableRuleExecutor.java
+++
b/features/broadcast/distsql/handler/src/main/java/org/apache/shardingsphere/broadcast/distsql/handler/query/ShowBroadcastTableRuleExecutor.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.broadcast.distsql.handler.query;
import lombok.Setter;
import
org.apache.shardingsphere.broadcast.distsql.statement.ShowBroadcastTableRulesStatement;
import org.apache.shardingsphere.broadcast.rule.BroadcastRule;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -33,7 +33,7 @@ import java.util.stream.Collectors;
* Show broadcast table rule executor.
*/
@Setter
-public final class ShowBroadcastTableRuleExecutor implements
RQLExecutor<ShowBroadcastTableRulesStatement>,
DatabaseRuleAwareRQLExecutor<BroadcastRule> {
+public final class ShowBroadcastTableRuleExecutor implements
RQLExecutor<ShowBroadcastTableRulesStatement>,
DistSQLExecutorRuleAware<BroadcastRule> {
private BroadcastRule rule;
diff --git
a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java
b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java
index f70ae982ce1..13b90777f69 100644
---
a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java
+++
b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.encrypt.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
import
org.apache.shardingsphere.encrypt.api.config.rule.EncryptColumnItemRuleConfiguration;
import
org.apache.shardingsphere.encrypt.api.config.rule.EncryptColumnRuleConfiguration;
@@ -41,7 +41,7 @@ import java.util.stream.Collectors;
* Show encrypt rule executor.
*/
@Setter
-public final class ShowEncryptRuleExecutor implements
RQLExecutor<ShowEncryptRulesStatement>,
DatabaseRuleAwareRQLExecutor<EncryptRule> {
+public final class ShowEncryptRuleExecutor implements
RQLExecutor<ShowEncryptRulesStatement>, DistSQLExecutorRuleAware<EncryptRule> {
private EncryptRule rule;
diff --git
a/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/ShowMaskRuleExecutor.java
b/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/ShowMaskRuleExecutor.java
index f0e6ceda851..61dbe750227 100644
---
a/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/ShowMaskRuleExecutor.java
+++
b/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/ShowMaskRuleExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.mask.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.props.PropertiesConverter;
@@ -38,7 +38,7 @@ import java.util.stream.Collectors;
* Show mask rule executor.
*/
@Setter
-public final class ShowMaskRuleExecutor implements
RQLExecutor<ShowMaskRulesStatement>, DatabaseRuleAwareRQLExecutor<MaskRule> {
+public final class ShowMaskRuleExecutor implements
RQLExecutor<ShowMaskRulesStatement>, DistSQLExecutorRuleAware<MaskRule> {
private MaskRule rule;
diff --git
a/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ShowReadwriteSplittingRuleExecutor.java
b/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ShowReadwriteSplittingRuleExecutor.java
index ef2a6c4c02d..05724166520 100644
---
a/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ShowReadwriteSplittingRuleExecutor.java
+++
b/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ShowReadwriteSplittingRuleExecutor.java
@@ -19,8 +19,8 @@ package
org.apache.shardingsphere.readwritesplitting.distsql.handler.query;
import com.google.common.base.Joiner;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.props.PropertiesConverter;
@@ -43,7 +43,7 @@ import java.util.Optional;
* Show readwrite-splitting rule executor.
*/
@Setter
-public final class ShowReadwriteSplittingRuleExecutor implements
RQLExecutor<ShowReadwriteSplittingRulesStatement>,
DatabaseRuleAwareRQLExecutor<ReadwriteSplittingRule> {
+public final class ShowReadwriteSplittingRuleExecutor implements
RQLExecutor<ShowReadwriteSplittingRulesStatement>,
DistSQLExecutorRuleAware<ReadwriteSplittingRule> {
private ReadwriteSplittingRule rule;
diff --git
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowDefaultShadowAlgorithmExecutor.java
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowDefaultShadowAlgorithmExecutor.java
index 9f107a321c3..851a7c45612 100644
---
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowDefaultShadowAlgorithmExecutor.java
+++
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowDefaultShadowAlgorithmExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.shadow.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.props.PropertiesConverter;
@@ -38,7 +38,7 @@ import java.util.stream.Collectors;
* Show default shadow algorithm executor.
*/
@Setter
-public final class ShowDefaultShadowAlgorithmExecutor implements
RQLExecutor<ShowDefaultShadowAlgorithmStatement>,
DatabaseRuleAwareRQLExecutor<ShadowRule> {
+public final class ShowDefaultShadowAlgorithmExecutor implements
RQLExecutor<ShowDefaultShadowAlgorithmStatement>,
DistSQLExecutorRuleAware<ShadowRule> {
private ShadowRule rule;
diff --git
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowAlgorithmsExecutor.java
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowAlgorithmsExecutor.java
index a538ca968bf..97069f37c01 100644
---
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowAlgorithmsExecutor.java
+++
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowAlgorithmsExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.shadow.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.props.PropertiesConverter;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -35,7 +35,7 @@ import java.util.stream.Collectors;
* Show shadow algorithms executor.
*/
@Setter
-public final class ShowShadowAlgorithmsExecutor implements
RQLExecutor<ShowShadowAlgorithmsStatement>,
DatabaseRuleAwareRQLExecutor<ShadowRule> {
+public final class ShowShadowAlgorithmsExecutor implements
RQLExecutor<ShowShadowAlgorithmsStatement>,
DistSQLExecutorRuleAware<ShadowRule> {
private ShadowRule rule;
diff --git
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowRuleExecutor.java
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowRuleExecutor.java
index 6f6891f28de..9f735d44bb7 100644
---
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowRuleExecutor.java
+++
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowRuleExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.shadow.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.props.PropertiesConverter;
@@ -41,7 +41,7 @@ import java.util.stream.Collectors;
* Show shadow rule executor.
*/
@Setter
-public final class ShowShadowRuleExecutor implements
RQLExecutor<ShowShadowRulesStatement>, DatabaseRuleAwareRQLExecutor<ShadowRule>
{
+public final class ShowShadowRuleExecutor implements
RQLExecutor<ShowShadowRulesStatement>, DistSQLExecutorRuleAware<ShadowRule> {
private ShadowRule rule;
diff --git
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowTableRulesExecutor.java
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowTableRulesExecutor.java
index 2b914c17d6f..454bc1dd471 100644
---
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowTableRulesExecutor.java
+++
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowTableRulesExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.shadow.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
@@ -37,7 +37,7 @@ import java.util.stream.Collectors;
* Show shadow table rules executor.
*/
@Setter
-public final class ShowShadowTableRulesExecutor implements
RQLExecutor<ShowShadowTableRulesStatement>,
DatabaseRuleAwareRQLExecutor<ShadowRule> {
+public final class ShowShadowTableRulesExecutor implements
RQLExecutor<ShowShadowTableRulesStatement>,
DistSQLExecutorRuleAware<ShadowRule> {
private static final String SHADOW_TABLE = "shadow_table";
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowDefaultShardingStrategyExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowDefaultShardingStrategyExecutor.java
index 069a1423302..73b0d9b71b9 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowDefaultShardingStrategyExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowDefaultShardingStrategyExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.sharding.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -38,7 +38,7 @@ import java.util.LinkedList;
* Show default sharding strategy executor.
*/
@Setter
-public final class ShowDefaultShardingStrategyExecutor implements
RQLExecutor<ShowDefaultShardingStrategyStatement>,
DatabaseRuleAwareRQLExecutor<ShardingRule> {
+public final class ShowDefaultShardingStrategyExecutor implements
RQLExecutor<ShowDefaultShardingStrategyStatement>,
DistSQLExecutorRuleAware<ShardingRule> {
private ShardingRule rule;
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingAlgorithmExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingAlgorithmExecutor.java
index 0c4c0407c9a..ecec2e56cb1 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingAlgorithmExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingAlgorithmExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.sharding.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.props.PropertiesConverter;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -35,7 +35,7 @@ import java.util.stream.Collectors;
* Show sharding algorithm executor.
*/
@Setter
-public final class ShowShardingAlgorithmExecutor implements
RQLExecutor<ShowShardingAlgorithmsStatement>,
DatabaseRuleAwareRQLExecutor<ShardingRule> {
+public final class ShowShardingAlgorithmExecutor implements
RQLExecutor<ShowShardingAlgorithmsStatement>,
DistSQLExecutorRuleAware<ShardingRule> {
private ShardingRule rule;
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingAuditorsExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingAuditorsExecutor.java
index ecce91452ed..bce7544c792 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingAuditorsExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingAuditorsExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.sharding.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.props.PropertiesConverter;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -34,7 +34,7 @@ import java.util.stream.Collectors;
* Show sharding auditors executor.
*/
@Setter
-public final class ShowShardingAuditorsExecutor implements
RQLExecutor<ShowShardingAuditorsStatement>,
DatabaseRuleAwareRQLExecutor<ShardingRule> {
+public final class ShowShardingAuditorsExecutor implements
RQLExecutor<ShowShardingAuditorsStatement>,
DistSQLExecutorRuleAware<ShardingRule> {
private ShardingRule rule;
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingKeyGeneratorExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingKeyGeneratorExecutor.java
index 32e4718d14a..abed749a45a 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingKeyGeneratorExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingKeyGeneratorExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.sharding.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.props.PropertiesConverter;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -34,7 +34,7 @@ import java.util.stream.Collectors;
* Show sharding key generator executor.
*/
@Setter
-public final class ShowShardingKeyGeneratorExecutor implements
RQLExecutor<ShowShardingKeyGeneratorsStatement>,
DatabaseRuleAwareRQLExecutor<ShardingRule> {
+public final class ShowShardingKeyGeneratorExecutor implements
RQLExecutor<ShowShardingKeyGeneratorsStatement>,
DistSQLExecutorRuleAware<ShardingRule> {
private ShardingRule rule;
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableNodesExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableNodesExecutor.java
index 235ba324e84..de4b5c4dd65 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableNodesExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableNodesExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.sharding.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import org.apache.shardingsphere.infra.datanode.DataNode;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -36,7 +36,7 @@ import java.util.stream.Collectors;
* Show sharding table nodes executor.
*/
@Setter
-public final class ShowShardingTableNodesExecutor implements
RQLExecutor<ShowShardingTableNodesStatement>,
DatabaseRuleAwareRQLExecutor<ShardingRule> {
+public final class ShowShardingTableNodesExecutor implements
RQLExecutor<ShowShardingTableNodesStatement>,
DistSQLExecutorRuleAware<ShardingRule> {
private ShardingRule rule;
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableReferenceRuleExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableReferenceRuleExecutor.java
index ff15fd083ab..7e3f662841f 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableReferenceRuleExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableReferenceRuleExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.sharding.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.mode.manager.ContextManager;
import
org.apache.shardingsphere.sharding.distsql.statement.ShowShardingTableReferenceRulesStatement;
@@ -33,7 +33,7 @@ import java.util.stream.Collectors;
* Show sharding table reference rules executor.
*/
@Setter
-public final class ShowShardingTableReferenceRuleExecutor implements
RQLExecutor<ShowShardingTableReferenceRulesStatement>,
DatabaseRuleAwareRQLExecutor<ShardingRule> {
+public final class ShowShardingTableReferenceRuleExecutor implements
RQLExecutor<ShowShardingTableReferenceRulesStatement>,
DistSQLExecutorRuleAware<ShardingRule> {
private ShardingRule rule;
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRuleExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRuleExecutor.java
index caa247fa09f..75b08234cf6 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRuleExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRuleExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.sharding.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.props.PropertiesConverter;
@@ -46,7 +46,7 @@ import java.util.stream.Collectors;
* Show sharding table rules executor.
*/
@Setter
-public final class ShowShardingTableRuleExecutor implements
RQLExecutor<ShowShardingTableRulesStatement>,
DatabaseRuleAwareRQLExecutor<ShardingRule> {
+public final class ShowShardingTableRuleExecutor implements
RQLExecutor<ShowShardingTableRulesStatement>,
DistSQLExecutorRuleAware<ShardingRule> {
private ShardingRule rule;
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRulesUsedAlgorithmExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRulesUsedAlgorithmExecutor.java
index e428107d3c1..2ada13e2f6c 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRulesUsedAlgorithmExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRulesUsedAlgorithmExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.sharding.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
@@ -36,7 +36,7 @@ import java.util.LinkedList;
* Show sharding table rules used algorithm executor.
*/
@Setter
-public final class ShowShardingTableRulesUsedAlgorithmExecutor implements
RQLExecutor<ShowShardingTableRulesUsedAlgorithmStatement>,
DatabaseRuleAwareRQLExecutor<ShardingRule> {
+public final class ShowShardingTableRulesUsedAlgorithmExecutor implements
RQLExecutor<ShowShardingTableRulesUsedAlgorithmStatement>,
DistSQLExecutorRuleAware<ShardingRule> {
private ShardingRule rule;
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRulesUsedAuditorExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRulesUsedAuditorExecutor.java
index 2ca055e5260..c9df3064c6c 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRulesUsedAuditorExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRulesUsedAuditorExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.sharding.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.mode.manager.ContextManager;
import
org.apache.shardingsphere.sharding.distsql.statement.ShowShardingTableRulesUsedAuditorStatement;
@@ -34,7 +34,7 @@ import java.util.LinkedList;
* Show sharding table rules used auditor executor.
*/
@Setter
-public final class ShowShardingTableRulesUsedAuditorExecutor implements
RQLExecutor<ShowShardingTableRulesUsedAuditorStatement>,
DatabaseRuleAwareRQLExecutor<ShardingRule> {
+public final class ShowShardingTableRulesUsedAuditorExecutor implements
RQLExecutor<ShowShardingTableRulesUsedAuditorStatement>,
DistSQLExecutorRuleAware<ShardingRule> {
private ShardingRule rule;
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRulesUsedKeyGeneratorExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRulesUsedKeyGeneratorExecutor.java
index 061015645ac..c55e85529ea 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRulesUsedKeyGeneratorExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRulesUsedKeyGeneratorExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.sharding.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.mode.manager.ContextManager;
import
org.apache.shardingsphere.sharding.distsql.statement.ShowShardingTableRulesUsedKeyGeneratorStatement;
@@ -34,7 +34,7 @@ import java.util.LinkedList;
* Show sharding table rules used key generator executor.
*/
@Setter
-public final class ShowShardingTableRulesUsedKeyGeneratorExecutor implements
RQLExecutor<ShowShardingTableRulesUsedKeyGeneratorStatement>,
DatabaseRuleAwareRQLExecutor<ShardingRule> {
+public final class ShowShardingTableRulesUsedKeyGeneratorExecutor implements
RQLExecutor<ShowShardingTableRulesUsedKeyGeneratorStatement>,
DistSQLExecutorRuleAware<ShardingRule> {
private ShardingRule rule;
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowUnusedShardingAlgorithmsExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowUnusedShardingAlgorithmsExecutor.java
index 5e626be6725..30500850a38 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowUnusedShardingAlgorithmsExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowUnusedShardingAlgorithmsExecutor.java
@@ -19,8 +19,8 @@ package
org.apache.shardingsphere.sharding.distsql.handler.query;
import com.google.common.base.Strings;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.props.PropertiesConverter;
@@ -41,7 +41,7 @@ import java.util.Properties;
* Show unused sharding algorithms executor.
*/
@Setter
-public final class ShowUnusedShardingAlgorithmsExecutor implements
RQLExecutor<ShowUnusedShardingAlgorithmsStatement>,
DatabaseRuleAwareRQLExecutor<ShardingRule> {
+public final class ShowUnusedShardingAlgorithmsExecutor implements
RQLExecutor<ShowUnusedShardingAlgorithmsStatement>,
DistSQLExecutorRuleAware<ShardingRule> {
private ShardingRule rule;
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowUnusedShardingAuditorsExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowUnusedShardingAuditorsExecutor.java
index 693a3b2cf13..5e7f4e53fb5 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowUnusedShardingAuditorsExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowUnusedShardingAuditorsExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.sharding.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.props.PropertiesConverter;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -37,7 +37,7 @@ import java.util.stream.Collectors;
* Show unused sharding auditors executor.
*/
@Setter
-public final class ShowUnusedShardingAuditorsExecutor implements
RQLExecutor<ShowUnusedShardingAuditorsStatement>,
DatabaseRuleAwareRQLExecutor<ShardingRule> {
+public final class ShowUnusedShardingAuditorsExecutor implements
RQLExecutor<ShowUnusedShardingAuditorsStatement>,
DistSQLExecutorRuleAware<ShardingRule> {
private ShardingRule rule;
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowUnusedShardingKeyGeneratorExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowUnusedShardingKeyGeneratorExecutor.java
index 0b8e624ebb4..ab67c2468aa 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowUnusedShardingKeyGeneratorExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowUnusedShardingKeyGeneratorExecutor.java
@@ -19,8 +19,8 @@ package
org.apache.shardingsphere.sharding.distsql.handler.query;
import com.google.common.base.Strings;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.props.PropertiesConverter;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -39,7 +39,7 @@ import java.util.stream.Collectors;
* Show unused sharding key generator executor.
*/
@Setter
-public final class ShowUnusedShardingKeyGeneratorExecutor implements
RQLExecutor<ShowUnusedShardingKeyGeneratorsStatement>,
DatabaseRuleAwareRQLExecutor<ShardingRule> {
+public final class ShowUnusedShardingKeyGeneratorExecutor implements
RQLExecutor<ShowUnusedShardingKeyGeneratorsStatement>,
DistSQLExecutorRuleAware<ShardingRule> {
private ShardingRule rule;
diff --git
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/aware/DistSQLExecutorConnectionSizeAware.java
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/aware/DistSQLExecutorConnectionSizeAware.java
index 42890750269..92d065d32af 100644
---
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/aware/DistSQLExecutorConnectionSizeAware.java
+++
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/aware/DistSQLExecutorConnectionSizeAware.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.distsql.handler.aware;
/**
- * Connection size aware queryable RAL executor.
+ * DistSQL executor connection size aware.
*/
public interface DistSQLExecutorConnectionSizeAware {
diff --git
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/aware/DatabaseRuleAwareRQLExecutor.java
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/aware/DistSQLExecutorRuleAware.java
similarity index 68%
rename from
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/aware/DatabaseRuleAwareRQLExecutor.java
rename to
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/aware/DistSQLExecutorRuleAware.java
index 97d3bc3af56..fcb7a410398 100644
---
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/aware/DatabaseRuleAwareRQLExecutor.java
+++
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/aware/DistSQLExecutorRuleAware.java
@@ -15,21 +15,19 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.distsql.handler.type.rql.aware;
+package org.apache.shardingsphere.distsql.handler.aware;
-import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorDatabaseAware;
-import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
/**
- * Database rule aware RQL executor.
+ * DistSQL executor rule aware.
*
* @param <T> type of ShardingSphere rule
*/
-public interface DatabaseRuleAwareRQLExecutor<T extends ShardingSphereRule>
extends DistSQLExecutorDatabaseAware {
+public interface DistSQLExecutorRuleAware<T extends ShardingSphereRule> {
/**
- * Set ShardingSphere rule.
+ * Set rule.
*
* @param rule rule
*/
@@ -41,8 +39,4 @@ public interface DatabaseRuleAwareRQLExecutor<T extends
ShardingSphereRule> exte
* @return rule class
*/
Class<T> getRuleClass();
-
- @Override
- default void setDatabase(ShardingSphereDatabase database) {
- }
}
diff --git
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/RQLExecuteEngine.java
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/RQLExecuteEngine.java
index 9a0a38e6821..ed152761d74 100644
---
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/RQLExecuteEngine.java
+++
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/RQLExecuteEngine.java
@@ -20,10 +20,11 @@ package org.apache.shardingsphere.distsql.handler.type.rql;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorDatabaseAware;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.GlobalRuleAwareRQLExecutor;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.util.DatabaseNameUtils;
import org.apache.shardingsphere.distsql.statement.rql.RQLStatement;
+import
org.apache.shardingsphere.infra.exception.dialect.exception.syntax.database.NoDatabaseSelectedException;
+import
org.apache.shardingsphere.infra.exception.dialect.exception.syntax.database.UnknownDatabaseException;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
@@ -63,10 +64,10 @@ public abstract class RQLExecuteEngine {
RQLExecutor executor = TypedSPILoader.getService(RQLExecutor.class,
sqlStatement.getClass());
columnNames = executor.getColumnNames();
if (executor instanceof DistSQLExecutorDatabaseAware) {
- setUpDatabaseAwareExecutor((DistSQLExecutorDatabaseAware)
executor);
+ ((DistSQLExecutorDatabaseAware)
executor).setDatabase(getDatabase(DatabaseNameUtils.getDatabaseName(sqlStatement,
currentDatabaseName)));
}
- if (executor instanceof GlobalRuleAwareRQLExecutor) {
- setUpGlobalRuleAwareExecutor((GlobalRuleAwareRQLExecutor)
executor);
+ if (executor instanceof DistSQLExecutorRuleAware) {
+ setRule((DistSQLExecutorRuleAware) executor);
}
if (null == rows) {
rows = executor.getRows(sqlStatement, contextManager);
@@ -74,27 +75,25 @@ public abstract class RQLExecuteEngine {
}
@SuppressWarnings({"rawtypes", "unchecked"})
- private void setUpDatabaseAwareExecutor(final DistSQLExecutorDatabaseAware
executor) {
- ShardingSphereDatabase database =
getDatabase(DatabaseNameUtils.getDatabaseName(sqlStatement,
currentDatabaseName));
- executor.setDatabase(database);
- if (executor instanceof DatabaseRuleAwareRQLExecutor) {
- Optional<ShardingSphereRule> rule =
database.getRuleMetaData().findSingleRule(((DatabaseRuleAwareRQLExecutor)
executor).getRuleClass());
- if (rule.isPresent()) {
- ((DatabaseRuleAwareRQLExecutor) executor).setRule(rule.get());
- } else {
- rows = Collections.emptyList();
- }
+ private void setRule(final DistSQLExecutorRuleAware executor) {
+ Optional<ShardingSphereRule> globalRule =
contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().findSingleRule(executor.getRuleClass());
+ if (globalRule.isPresent()) {
+ executor.setRule(globalRule.get());
+ return;
}
- }
-
- @SuppressWarnings({"rawtypes", "unchecked"})
- private void setUpGlobalRuleAwareExecutor(final GlobalRuleAwareRQLExecutor
executor) {
- Optional<ShardingSphereRule> rule =
contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().findSingleRule(executor.getRuleClass());
- if (rule.isPresent()) {
- executor.setRule(rule.get());
- } else {
+ ShardingSphereDatabase database;
+ try {
+ database =
getDatabase(DatabaseNameUtils.getDatabaseName(sqlStatement,
currentDatabaseName));
+ } catch (final NoDatabaseSelectedException | UnknownDatabaseException
ignored) {
rows = Collections.emptyList();
+ return;
+ }
+ Optional<ShardingSphereRule> databaseRule =
database.getRuleMetaData().findSingleRule(executor.getRuleClass());
+ if (databaseRule.isPresent()) {
+ executor.setRule(databaseRule.get());
+ return;
}
+ rows = Collections.emptyList();
}
protected abstract ShardingSphereDatabase getDatabase(String databaseName);
diff --git
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/aware/GlobalRuleAwareRQLExecutor.java
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/aware/GlobalRuleAwareRQLExecutor.java
deleted file mode 100644
index 5e2818edf13..00000000000
---
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/aware/GlobalRuleAwareRQLExecutor.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.distsql.handler.type.rql.aware;
-
-import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import org.apache.shardingsphere.distsql.statement.rql.RQLStatement;
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
-
-/**
- * Global rule aware RQL executor.
- *
- * @param <T> type of SQL statement
- * @param <R> type of ShardingSphere rule
- */
-public interface GlobalRuleAwareRQLExecutor<T extends RQLStatement, R extends
ShardingSphereRule> extends RQLExecutor<T> {
-
- /**
- * Set ShardingSphere rule.
- *
- * @param rule rule
- */
- void setRule(R rule);
-
- /**
- * Get rule class.
- *
- * @return rule class
- */
- Class<R> getRuleClass();
-}
diff --git
a/kernel/authority/distsql/handler/src/main/java/org/apache/shardingsphere/authority/distsql/handler/ShowAuthorityRuleExecutor.java
b/kernel/authority/distsql/handler/src/main/java/org/apache/shardingsphere/authority/distsql/handler/ShowAuthorityRuleExecutor.java
index 013162e6c4c..f4bb66af8f4 100644
---
a/kernel/authority/distsql/handler/src/main/java/org/apache/shardingsphere/authority/distsql/handler/ShowAuthorityRuleExecutor.java
+++
b/kernel/authority/distsql/handler/src/main/java/org/apache/shardingsphere/authority/distsql/handler/ShowAuthorityRuleExecutor.java
@@ -21,7 +21,8 @@ import lombok.Setter;
import org.apache.shardingsphere.authority.config.AuthorityRuleConfiguration;
import
org.apache.shardingsphere.authority.distsql.statement.ShowAuthorityRuleStatement;
import org.apache.shardingsphere.authority.rule.AuthorityRule;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.GlobalRuleAwareRQLExecutor;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
+import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -34,7 +35,7 @@ import java.util.stream.Collectors;
* Show authority rule executor.
*/
@Setter
-public final class ShowAuthorityRuleExecutor implements
GlobalRuleAwareRQLExecutor<ShowAuthorityRuleStatement, AuthorityRule> {
+public final class ShowAuthorityRuleExecutor implements
RQLExecutor<ShowAuthorityRuleStatement>,
DistSQLExecutorRuleAware<AuthorityRule> {
private AuthorityRule rule;
diff --git
a/kernel/global-clock/distsql/handler/src/main/java/org/apache/shardingsphere/globalclock/distsql/handler/query/ShowGlobalClockRuleExecutor.java
b/kernel/global-clock/distsql/handler/src/main/java/org/apache/shardingsphere/globalclock/distsql/handler/query/ShowGlobalClockRuleExecutor.java
index cb81589206a..4a1e30a5b12 100644
---
a/kernel/global-clock/distsql/handler/src/main/java/org/apache/shardingsphere/globalclock/distsql/handler/query/ShowGlobalClockRuleExecutor.java
+++
b/kernel/global-clock/distsql/handler/src/main/java/org/apache/shardingsphere/globalclock/distsql/handler/query/ShowGlobalClockRuleExecutor.java
@@ -18,7 +18,8 @@
package org.apache.shardingsphere.globalclock.distsql.handler.query;
import lombok.Setter;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.GlobalRuleAwareRQLExecutor;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
+import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
import
org.apache.shardingsphere.globalclock.api.config.GlobalClockRuleConfiguration;
import org.apache.shardingsphere.globalclock.core.rule.GlobalClockRule;
import
org.apache.shardingsphere.globalclock.distsql.statement.queryable.ShowGlobalClockRuleStatement;
@@ -34,7 +35,7 @@ import java.util.Collections;
* Show global clock rule executor.
*/
@Setter
-public final class ShowGlobalClockRuleExecutor implements
GlobalRuleAwareRQLExecutor<ShowGlobalClockRuleStatement, GlobalClockRule> {
+public final class ShowGlobalClockRuleExecutor implements
RQLExecutor<ShowGlobalClockRuleStatement>,
DistSQLExecutorRuleAware<GlobalClockRule> {
private GlobalClockRule rule;
diff --git
a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/ShowDefaultSingleTableStorageUnitExecutor.java
b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/ShowDefaultSingleTableStorageUnitExecutor.java
index e1b6ac5e8e4..9d721ce442e 100644
---
a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/ShowDefaultSingleTableStorageUnitExecutor.java
+++
b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/ShowDefaultSingleTableStorageUnitExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.single.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.mode.manager.ContextManager;
import
org.apache.shardingsphere.single.distsql.statement.rql.ShowDefaultSingleTableStorageUnitStatement;
@@ -32,7 +32,7 @@ import java.util.Collections;
* Show default single table storage unit executor.
*/
@Setter
-public final class ShowDefaultSingleTableStorageUnitExecutor implements
RQLExecutor<ShowDefaultSingleTableStorageUnitStatement>,
DatabaseRuleAwareRQLExecutor<SingleRule> {
+public final class ShowDefaultSingleTableStorageUnitExecutor implements
RQLExecutor<ShowDefaultSingleTableStorageUnitStatement>,
DistSQLExecutorRuleAware<SingleRule> {
private SingleRule rule;
diff --git
a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/ShowSingleTableExecutor.java
b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/ShowSingleTableExecutor.java
index f08670cfe4c..e3e242b0e6c 100644
---
a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/ShowSingleTableExecutor.java
+++
b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/ShowSingleTableExecutor.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.single.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import org.apache.shardingsphere.infra.datanode.DataNode;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -39,7 +39,7 @@ import java.util.stream.Collectors;
* Show single table executor.
*/
@Setter
-public final class ShowSingleTableExecutor implements
RQLExecutor<ShowSingleTableStatement>, DatabaseRuleAwareRQLExecutor<SingleRule>
{
+public final class ShowSingleTableExecutor implements
RQLExecutor<ShowSingleTableStatement>, DistSQLExecutorRuleAware<SingleRule> {
private SingleRule rule;
diff --git
a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/ShowUnloadedSingleTableExecutor.java
b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/ShowUnloadedSingleTableExecutor.java
index a825b5bb3bb..792c379650c 100644
---
a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/ShowUnloadedSingleTableExecutor.java
+++
b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/ShowUnloadedSingleTableExecutor.java
@@ -18,8 +18,9 @@
package org.apache.shardingsphere.single.distsql.handler.query;
import lombok.Setter;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorDatabaseAware;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.DatabaseRuleAwareRQLExecutor;
import org.apache.shardingsphere.infra.datanode.DataNode;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -42,7 +43,7 @@ import java.util.stream.Collectors;
* Show unloaded single table executor.
*/
@Setter
-public final class ShowUnloadedSingleTableExecutor implements
RQLExecutor<ShowUnloadedSingleTableStatement>,
DatabaseRuleAwareRQLExecutor<SingleRule> {
+public final class ShowUnloadedSingleTableExecutor implements
RQLExecutor<ShowUnloadedSingleTableStatement>, DistSQLExecutorDatabaseAware,
DistSQLExecutorRuleAware<SingleRule> {
private ShardingSphereDatabase database;
diff --git
a/kernel/sql-federation/distsql/handler/src/main/java/org/apache/shardingsphere/sqlfederation/distsql/handler/query/ShowSQLFederationRuleExecutor.java
b/kernel/sql-federation/distsql/handler/src/main/java/org/apache/shardingsphere/sqlfederation/distsql/handler/query/ShowSQLFederationRuleExecutor.java
index 88e295f51c9..f4eea26e011 100644
---
a/kernel/sql-federation/distsql/handler/src/main/java/org/apache/shardingsphere/sqlfederation/distsql/handler/query/ShowSQLFederationRuleExecutor.java
+++
b/kernel/sql-federation/distsql/handler/src/main/java/org/apache/shardingsphere/sqlfederation/distsql/handler/query/ShowSQLFederationRuleExecutor.java
@@ -18,7 +18,8 @@
package org.apache.shardingsphere.sqlfederation.distsql.handler.query;
import lombok.Setter;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.GlobalRuleAwareRQLExecutor;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
+import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.mode.manager.ContextManager;
import
org.apache.shardingsphere.sqlfederation.api.config.SQLFederationRuleConfiguration;
@@ -33,7 +34,7 @@ import java.util.Collections;
* Show SQL federation rule executor.
*/
@Setter
-public final class ShowSQLFederationRuleExecutor implements
GlobalRuleAwareRQLExecutor<ShowSQLFederationRuleStatement, SQLFederationRule> {
+public final class ShowSQLFederationRuleExecutor implements
RQLExecutor<ShowSQLFederationRuleStatement>,
DistSQLExecutorRuleAware<SQLFederationRule> {
private SQLFederationRule rule;
diff --git
a/kernel/sql-parser/distsql/handler/src/main/java/org/apache/shardingsphere/parser/distsql/handler/query/ShowSQLParserRuleExecutor.java
b/kernel/sql-parser/distsql/handler/src/main/java/org/apache/shardingsphere/parser/distsql/handler/query/ShowSQLParserRuleExecutor.java
index 77414927de7..ee2960686e5 100644
---
a/kernel/sql-parser/distsql/handler/src/main/java/org/apache/shardingsphere/parser/distsql/handler/query/ShowSQLParserRuleExecutor.java
+++
b/kernel/sql-parser/distsql/handler/src/main/java/org/apache/shardingsphere/parser/distsql/handler/query/ShowSQLParserRuleExecutor.java
@@ -18,7 +18,8 @@
package org.apache.shardingsphere.parser.distsql.handler.query;
import lombok.Setter;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.GlobalRuleAwareRQLExecutor;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
+import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.parser.config.SQLParserRuleConfiguration;
@@ -33,7 +34,7 @@ import java.util.Collections;
* Show SQL parser rule executor.
*/
@Setter
-public final class ShowSQLParserRuleExecutor implements
GlobalRuleAwareRQLExecutor<ShowSQLParserRuleStatement, SQLParserRule> {
+public final class ShowSQLParserRuleExecutor implements
RQLExecutor<ShowSQLParserRuleStatement>,
DistSQLExecutorRuleAware<SQLParserRule> {
private SQLParserRule rule;
diff --git
a/kernel/sql-translator/distsql/handler/src/main/java/org/apache/shardingsphere/sqltranslator/distsql/handler/query/ShowSQLTranslatorRuleExecutor.java
b/kernel/sql-translator/distsql/handler/src/main/java/org/apache/shardingsphere/sqltranslator/distsql/handler/query/ShowSQLTranslatorRuleExecutor.java
index 024b598a51f..afb3f645fe2 100644
---
a/kernel/sql-translator/distsql/handler/src/main/java/org/apache/shardingsphere/sqltranslator/distsql/handler/query/ShowSQLTranslatorRuleExecutor.java
+++
b/kernel/sql-translator/distsql/handler/src/main/java/org/apache/shardingsphere/sqltranslator/distsql/handler/query/ShowSQLTranslatorRuleExecutor.java
@@ -18,7 +18,8 @@
package org.apache.shardingsphere.sqltranslator.distsql.handler.query;
import lombok.Setter;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.GlobalRuleAwareRQLExecutor;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
+import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.props.PropertiesConverter;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -34,7 +35,7 @@ import java.util.Collections;
* Show SQL translator rule executor.
*/
@Setter
-public final class ShowSQLTranslatorRuleExecutor implements
GlobalRuleAwareRQLExecutor<ShowSQLTranslatorRuleStatement, SQLTranslatorRule> {
+public final class ShowSQLTranslatorRuleExecutor implements
RQLExecutor<ShowSQLTranslatorRuleStatement>,
DistSQLExecutorRuleAware<SQLTranslatorRule> {
private SQLTranslatorRule rule;
diff --git
a/kernel/traffic/distsql/handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/query/ShowTrafficRuleExecutor.java
b/kernel/traffic/distsql/handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/query/ShowTrafficRuleExecutor.java
index 64af4a03898..161f86f6031 100644
---
a/kernel/traffic/distsql/handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/query/ShowTrafficRuleExecutor.java
+++
b/kernel/traffic/distsql/handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/query/ShowTrafficRuleExecutor.java
@@ -18,7 +18,8 @@
package org.apache.shardingsphere.traffic.distsql.handler.query;
import lombok.Setter;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.GlobalRuleAwareRQLExecutor;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
+import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.props.PropertiesConverter;
@@ -36,7 +37,7 @@ import java.util.LinkedList;
* Show traffic rule executor.
*/
@Setter
-public final class ShowTrafficRuleExecutor implements
GlobalRuleAwareRQLExecutor<ShowTrafficRulesStatement, TrafficRule> {
+public final class ShowTrafficRuleExecutor implements
RQLExecutor<ShowTrafficRulesStatement>, DistSQLExecutorRuleAware<TrafficRule> {
private TrafficRule rule;
diff --git
a/kernel/transaction/distsql/handler/src/main/java/org/apache/shardingsphere/transaction/distsql/handler/query/ShowTransactionRuleExecutor.java
b/kernel/transaction/distsql/handler/src/main/java/org/apache/shardingsphere/transaction/distsql/handler/query/ShowTransactionRuleExecutor.java
index 1ad935ad7f0..46010b464d0 100644
---
a/kernel/transaction/distsql/handler/src/main/java/org/apache/shardingsphere/transaction/distsql/handler/query/ShowTransactionRuleExecutor.java
+++
b/kernel/transaction/distsql/handler/src/main/java/org/apache/shardingsphere/transaction/distsql/handler/query/ShowTransactionRuleExecutor.java
@@ -18,7 +18,8 @@
package org.apache.shardingsphere.transaction.distsql.handler.query;
import lombok.Setter;
-import
org.apache.shardingsphere.distsql.handler.type.rql.aware.GlobalRuleAwareRQLExecutor;
+import
org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorRuleAware;
+import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.props.PropertiesConverter;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -33,7 +34,7 @@ import java.util.Collections;
* Show transaction rule executor.
*/
@Setter
-public final class ShowTransactionRuleExecutor implements
GlobalRuleAwareRQLExecutor<ShowTransactionRuleStatement, TransactionRule> {
+public final class ShowTransactionRuleExecutor implements
RQLExecutor<ShowTransactionRuleStatement>,
DistSQLExecutorRuleAware<TransactionRule> {
private TransactionRule rule;