This is an automated email from the ASF dual-hosted git repository. yx9o 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 ea552036e63 Merge MetaDataRequiredQueryableRALExecutor and QueryableRALExecutor (#29710) ea552036e63 is described below commit ea552036e634d8395ade78123cca0bd7c1a31d74 Author: Liang Zhang <zhangli...@apache.org> AuthorDate: Sat Jan 13 00:42:19 2024 +0800 Merge MetaDataRequiredQueryableRALExecutor and QueryableRALExecutor (#29710) * Merge MetaDataRequiredQueryableRALExecutor and QueryableRALExecutor * Merge MetaDataRequiredQueryableRALExecutor and QueryableRALExecutor --- .../ShowEncryptAlgorithmImplementationsExecutor.java | 3 ++- ...howEncryptAlgorithmImplementationsExecutorTest.java | 3 ++- .../ShowMaskAlgorithmImplementationsExecutor.java | 3 ++- .../ShowMaskAlgorithmImplementationsExecutorTest.java | 3 ++- ...eryLoadBalanceAlgorithmImplementationsExecutor.java | 3 ++- ...oadBalanceAlgorithmImplementationsExecutorTest.java | 3 ++- .../ShowShadowAlgorithmImplementationsExecutor.java | 3 ++- ...ShowShadowAlgorithmImplementationsExecutorTest.java | 3 ++- .../ShowShardingAlgorithmImplementationsExecutor.java | 3 ++- ...owShardingAlgorithmImplementationsExecutorTest.java | 3 ++- .../handler/ral/query/QueryableRALExecutor.java | 4 +++- .../distsql/handler/ShowAuthorityRuleExecutor.java | 6 +++--- .../distsql/handler/ShowAuthorityRuleExecutorTest.java | 2 +- .../handler/query/ShowStreamingJobStatusExecutor.java | 3 ++- .../handler/query/ShowStreamingListExecutor.java | 3 ++- .../handler/query/ShowStreamingRuleExecutor.java | 3 ++- .../query/ShowMigrationCheckAlgorithmsExecutor.java | 3 ++- .../query/ShowMigrationCheckStatusExecutor.java | 3 ++- .../handler/query/ShowMigrationJobStatusExecutor.java | 3 ++- .../handler/query/ShowMigrationListExecutor.java | 3 ++- .../query/ShowMigrationSourceStorageUnitsExecutor.java | 3 ++- .../handler/query/ShowGlobalClockRuleExecutor.java | 8 ++++---- .../handler/query/ShowGlobalClockRuleExecutorTest.java | 2 +- .../handler/query/ShowSQLFederationRuleExecutor.java | 6 +++--- .../query/ShowSQLFederationRuleExecutorTest.java | 2 +- .../handler/query/ShowSQLParserRuleExecutor.java | 6 +++--- .../handler/query/ShowSQLParserRuleExecutorTest.java | 2 +- .../handler/query/ShowSQLTranslatorRuleExecutor.java | 6 +++--- .../query/ShowSQLTranslatorRuleExecutorTest.java | 2 +- .../distsql/handler/query/ShowTrafficRuleExecutor.java | 6 +++--- .../handler/query/ShowTrafficRuleExecutorTest.java | 2 +- .../handler/query/ShowTransactionRuleExecutor.java | 6 +++--- .../handler/query/ShowTransactionRuleExecutorTest.java | 4 ++-- .../distsql/ral/QueryableRALBackendHandler.java | 18 ++++++------------ .../queryable/ConvertYamlConfigurationExecutor.java | 3 ++- .../distsql/ral/queryable/ExportMetaDataExecutor.java | 6 +++--- .../ral/queryable/ExportStorageNodesExecutor.java | 6 +++--- ...howKeyGenerateAlgorithmImplementationsExecutor.java | 3 ++- .../ral/queryable/ShowMigrationRuleExecutor.java | 3 ++- .../ShowServiceProviderImplementationsExecutor.java | 3 ++- .../ConvertYamlConfigurationExecutorTest.java | 4 +++- .../ral/queryable/ExportMetaDataExecutorTest.java | 4 ++-- .../ral/queryable/ExportStorageNodesExecutorTest.java | 8 ++++---- ...eyGenerateAlgorithmImplementationsExecutorTest.java | 3 ++- ...ShowServiceProviderImplementationsExecutorTest.java | 3 ++- 45 files changed, 102 insertions(+), 80 deletions(-) diff --git a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptAlgorithmImplementationsExecutor.java b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptAlgorithmImplementationsExecutor.java index 1912e8d0d25..6c0647061a6 100644 --- a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptAlgorithmImplementationsExecutor.java +++ b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptAlgorithmImplementationsExecutor.java @@ -21,6 +21,7 @@ import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.encrypt.distsql.statement.ShowEncryptAlgorithmImplementationsStatement; import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader; import java.util.Arrays; @@ -38,7 +39,7 @@ public final class ShowEncryptAlgorithmImplementationsExecutor implements Querya } @Override - public Collection<LocalDataQueryResultRow> getRows(final ShowEncryptAlgorithmImplementationsStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowEncryptAlgorithmImplementationsStatement sqlStatement, final ShardingSphereMetaData metaData) { Collection<LocalDataQueryResultRow> result = new LinkedList<>(); Collection<EncryptAlgorithm> encryptAlgorithms = ShardingSphereServiceLoader.getServiceInstances(EncryptAlgorithm.class); for (EncryptAlgorithm each : encryptAlgorithms) { diff --git a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptAlgorithmImplementationsExecutorTest.java b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptAlgorithmImplementationsExecutorTest.java index 2d3907a7c7a..da8b2e5afdf 100644 --- a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptAlgorithmImplementationsExecutorTest.java +++ b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptAlgorithmImplementationsExecutorTest.java @@ -20,6 +20,7 @@ package org.apache.shardingsphere.encrypt.distsql.handler.query; import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.encrypt.distsql.statement.ShowEncryptAlgorithmImplementationsStatement; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.junit.jupiter.api.Test; import java.util.Collection; @@ -35,7 +36,7 @@ class ShowEncryptAlgorithmImplementationsExecutorTest { @Test void assertGetRowData() { QueryableRALExecutor<ShowEncryptAlgorithmImplementationsStatement> executor = new ShowEncryptAlgorithmImplementationsExecutor(); - Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowEncryptAlgorithmImplementationsStatement.class)); + Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowEncryptAlgorithmImplementationsStatement.class), mock(ShardingSphereMetaData.class)); assertFalse(actual.isEmpty()); Iterator<LocalDataQueryResultRow> iterator = actual.iterator(); LocalDataQueryResultRow row = iterator.next(); diff --git a/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/ShowMaskAlgorithmImplementationsExecutor.java b/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/ShowMaskAlgorithmImplementationsExecutor.java index 3ee2924516f..4dd56ff9a0c 100644 --- a/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/ShowMaskAlgorithmImplementationsExecutor.java +++ b/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/ShowMaskAlgorithmImplementationsExecutor.java @@ -19,6 +19,7 @@ package org.apache.shardingsphere.mask.distsql.handler.query; import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader; import org.apache.shardingsphere.mask.distsql.statement.ShowMaskAlgorithmImplementationsStatement; import org.apache.shardingsphere.mask.spi.MaskAlgorithm; @@ -39,7 +40,7 @@ public final class ShowMaskAlgorithmImplementationsExecutor implements Queryable @SuppressWarnings("rawtypes") @Override - public Collection<LocalDataQueryResultRow> getRows(final ShowMaskAlgorithmImplementationsStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowMaskAlgorithmImplementationsStatement sqlStatement, final ShardingSphereMetaData metaData) { Collection<LocalDataQueryResultRow> result = new LinkedList<>(); Collection<MaskAlgorithm> maskAlgorithms = ShardingSphereServiceLoader.getServiceInstances(MaskAlgorithm.class); for (MaskAlgorithm each : maskAlgorithms) { diff --git a/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/query/ShowMaskAlgorithmImplementationsExecutorTest.java b/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/query/ShowMaskAlgorithmImplementationsExecutorTest.java index 26c292d0863..6381ef69856 100644 --- a/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/query/ShowMaskAlgorithmImplementationsExecutorTest.java +++ b/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/query/ShowMaskAlgorithmImplementationsExecutorTest.java @@ -19,6 +19,7 @@ package org.apache.shardingsphere.mask.distsql.handler.query; import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.mask.distsql.statement.ShowMaskAlgorithmImplementationsStatement; import org.junit.jupiter.api.Test; @@ -35,7 +36,7 @@ class ShowMaskAlgorithmImplementationsExecutorTest { @Test void assertGetRowData() { QueryableRALExecutor<ShowMaskAlgorithmImplementationsStatement> executor = new ShowMaskAlgorithmImplementationsExecutor(); - Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowMaskAlgorithmImplementationsStatement.class)); + Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowMaskAlgorithmImplementationsStatement.class), mock(ShardingSphereMetaData.class)); assertFalse(actual.isEmpty()); Iterator<LocalDataQueryResultRow> iterator = actual.iterator(); LocalDataQueryResultRow row = iterator.next(); diff --git a/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ShowReadQueryLoadBalanceAlgorithmImplementationsExecutor.java b/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ShowReadQueryLoadBalanceAlgorithmImplementationsExecutor.java index dd182eacab7..288cc7d8484 100644 --- a/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ShowReadQueryLoadBalanceAlgorithmImplementationsExecutor.java +++ b/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ShowReadQueryLoadBalanceAlgorithmImplementationsExecutor.java @@ -19,6 +19,7 @@ package org.apache.shardingsphere.readwritesplitting.distsql.handler.query; import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader; import org.apache.shardingsphere.readwritesplitting.distsql.statement.ShowReadQueryLoadBalanceAlgorithmImplementationsStatement; import org.apache.shardingsphere.readwritesplitting.spi.ReadQueryLoadBalanceAlgorithm; @@ -38,7 +39,7 @@ public final class ShowReadQueryLoadBalanceAlgorithmImplementationsExecutor impl } @Override - public Collection<LocalDataQueryResultRow> getRows(final ShowReadQueryLoadBalanceAlgorithmImplementationsStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowReadQueryLoadBalanceAlgorithmImplementationsStatement sqlStatement, final ShardingSphereMetaData metaData) { Collection<LocalDataQueryResultRow> result = new LinkedList<>(); Collection<ReadQueryLoadBalanceAlgorithm> loadBalanceAlgorithms = ShardingSphereServiceLoader.getServiceInstances(ReadQueryLoadBalanceAlgorithm.class); for (ReadQueryLoadBalanceAlgorithm each : loadBalanceAlgorithms) { diff --git a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ShowReadQueryLoadBalanceAlgorithmImplementationsExecutorTest.java b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ShowReadQueryLoadBalanceAlgorithmImplementationsExecutorTest.java index efded393c55..f65c01dd771 100644 --- a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ShowReadQueryLoadBalanceAlgorithmImplementationsExecutorTest.java +++ b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ShowReadQueryLoadBalanceAlgorithmImplementationsExecutorTest.java @@ -19,6 +19,7 @@ package org.apache.shardingsphere.readwritesplitting.distsql.handler.query; import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.readwritesplitting.distsql.statement.ShowReadQueryLoadBalanceAlgorithmImplementationsStatement; import org.junit.jupiter.api.Test; @@ -35,7 +36,7 @@ class ShowReadQueryLoadBalanceAlgorithmImplementationsExecutorTest { @Test void assertGetRowData() { QueryableRALExecutor<ShowReadQueryLoadBalanceAlgorithmImplementationsStatement> executor = new ShowReadQueryLoadBalanceAlgorithmImplementationsExecutor(); - Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowReadQueryLoadBalanceAlgorithmImplementationsStatement.class)); + Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowReadQueryLoadBalanceAlgorithmImplementationsStatement.class), mock(ShardingSphereMetaData.class)); assertFalse(actual.isEmpty()); Iterator<LocalDataQueryResultRow> iterator = actual.iterator(); LocalDataQueryResultRow row = iterator.next(); diff --git a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowAlgorithmImplementationsExecutor.java b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowAlgorithmImplementationsExecutor.java index 9d6dfe72e78..c042e3e25e6 100644 --- a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowAlgorithmImplementationsExecutor.java +++ b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowAlgorithmImplementationsExecutor.java @@ -19,6 +19,7 @@ package org.apache.shardingsphere.shadow.distsql.handler.query; import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader; import org.apache.shardingsphere.shadow.distsql.statement.ShowShadowAlgorithmImplementationsStatement; import org.apache.shardingsphere.shadow.spi.ShadowAlgorithm; @@ -38,7 +39,7 @@ public final class ShowShadowAlgorithmImplementationsExecutor implements Queryab } @Override - public Collection<LocalDataQueryResultRow> getRows(final ShowShadowAlgorithmImplementationsStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowShadowAlgorithmImplementationsStatement sqlStatement, final ShardingSphereMetaData metaData) { Collection<LocalDataQueryResultRow> result = new LinkedList<>(); Collection<ShadowAlgorithm> shadowAlgorithms = ShardingSphereServiceLoader.getServiceInstances(ShadowAlgorithm.class); for (ShadowAlgorithm each : shadowAlgorithms) { diff --git a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/ShowShadowAlgorithmImplementationsExecutorTest.java b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/ShowShadowAlgorithmImplementationsExecutorTest.java index 91286bb3094..912bd811126 100644 --- a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/ShowShadowAlgorithmImplementationsExecutorTest.java +++ b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/ShowShadowAlgorithmImplementationsExecutorTest.java @@ -19,6 +19,7 @@ package org.apache.shardingsphere.shadow.distsql.query; import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.shadow.distsql.handler.query.ShowShadowAlgorithmImplementationsExecutor; import org.apache.shardingsphere.shadow.distsql.statement.ShowShadowAlgorithmImplementationsStatement; import org.junit.jupiter.api.Test; @@ -36,7 +37,7 @@ class ShowShadowAlgorithmImplementationsExecutorTest { @Test void assertGetRowData() { QueryableRALExecutor<ShowShadowAlgorithmImplementationsStatement> executor = new ShowShadowAlgorithmImplementationsExecutor(); - Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowShadowAlgorithmImplementationsStatement.class)); + Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowShadowAlgorithmImplementationsStatement.class), mock(ShardingSphereMetaData.class)); assertFalse(actual.isEmpty()); Iterator<LocalDataQueryResultRow> iterator = actual.iterator(); LocalDataQueryResultRow row = iterator.next(); diff --git a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingAlgorithmImplementationsExecutor.java b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingAlgorithmImplementationsExecutor.java index 6c5fb095e12..3681d8b9aa3 100644 --- a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingAlgorithmImplementationsExecutor.java +++ b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingAlgorithmImplementationsExecutor.java @@ -19,6 +19,7 @@ package org.apache.shardingsphere.sharding.distsql.handler.query; import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader; import org.apache.shardingsphere.sharding.distsql.statement.ShowShardingAlgorithmImplementationsStatement; import org.apache.shardingsphere.sharding.spi.ShardingAlgorithm; @@ -38,7 +39,7 @@ public final class ShowShardingAlgorithmImplementationsExecutor implements Query } @Override - public Collection<LocalDataQueryResultRow> getRows(final ShowShardingAlgorithmImplementationsStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowShardingAlgorithmImplementationsStatement sqlStatement, final ShardingSphereMetaData metaData) { Collection<LocalDataQueryResultRow> result = new LinkedList<>(); Collection<ShardingAlgorithm> shardingAlgorithms = ShardingSphereServiceLoader.getServiceInstances(ShardingAlgorithm.class); for (ShardingAlgorithm each : shardingAlgorithms) { diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShowShardingAlgorithmImplementationsExecutorTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShowShardingAlgorithmImplementationsExecutorTest.java index e810c063d55..4ca0b6e49c9 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShowShardingAlgorithmImplementationsExecutorTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShowShardingAlgorithmImplementationsExecutorTest.java @@ -19,6 +19,7 @@ package org.apache.shardingsphere.sharding.distsql.query; import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.sharding.distsql.handler.query.ShowShardingAlgorithmImplementationsExecutor; import org.apache.shardingsphere.sharding.distsql.statement.ShowShardingAlgorithmImplementationsStatement; import org.junit.jupiter.api.Test; @@ -36,7 +37,7 @@ class ShowShardingAlgorithmImplementationsExecutorTest { @Test void assertGetRowData() { QueryableRALExecutor<ShowShardingAlgorithmImplementationsStatement> executor = new ShowShardingAlgorithmImplementationsExecutor(); - Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowShardingAlgorithmImplementationsStatement.class)); + Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowShardingAlgorithmImplementationsStatement.class), mock(ShardingSphereMetaData.class)); assertFalse(actual.isEmpty()); Iterator<LocalDataQueryResultRow> iterator = actual.iterator(); LocalDataQueryResultRow row = iterator.next(); diff --git a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/ral/query/QueryableRALExecutor.java b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/ral/query/QueryableRALExecutor.java index 0460373aeee..b87454d6460 100644 --- a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/ral/query/QueryableRALExecutor.java +++ b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/ral/query/QueryableRALExecutor.java @@ -19,6 +19,7 @@ package org.apache.shardingsphere.distsql.handler.ral.query; import org.apache.shardingsphere.distsql.statement.ral.QueryableRALStatement; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPI; @@ -44,9 +45,10 @@ public interface QueryableRALExecutor<T extends QueryableRALStatement> extends T * Get query result rows. * * @param sqlStatement SQL statement + * @param metaData ShardingSphere meta data * @return query result rows */ - default Collection<LocalDataQueryResultRow> getRows(final T sqlStatement) { + default Collection<LocalDataQueryResultRow> getRows(final T sqlStatement, final ShardingSphereMetaData metaData) { return Collections.emptyList(); } 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 652f71ab30f..b4547c08841 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 @@ -20,7 +20,7 @@ package org.apache.shardingsphere.authority.distsql.handler; 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.ral.query.MetaDataRequiredQueryableRALExecutor; +import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; @@ -32,10 +32,10 @@ import java.util.stream.Collectors; /** * Show authority rule executor. */ -public final class ShowAuthorityRuleExecutor implements MetaDataRequiredQueryableRALExecutor<ShowAuthorityRuleStatement> { +public final class ShowAuthorityRuleExecutor implements QueryableRALExecutor<ShowAuthorityRuleStatement> { @Override - public Collection<LocalDataQueryResultRow> getRows(final ShardingSphereMetaData metaData, final ShowAuthorityRuleStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowAuthorityRuleStatement sqlStatement, final ShardingSphereMetaData metaData) { AuthorityRule rule = metaData.getGlobalRuleMetaData().getSingleRule(AuthorityRule.class); AuthorityRuleConfiguration ruleConfig = rule.getConfiguration(); return Collections.singleton(new LocalDataQueryResultRow(ruleConfig.getUsers().stream().map(each -> each.getGrantee().toString()).collect(Collectors.joining("; ")), diff --git a/kernel/authority/distsql/handler/src/test/java/org/apache/shardingsphere/authority/distsql/handler/ShowAuthorityRuleExecutorTest.java b/kernel/authority/distsql/handler/src/test/java/org/apache/shardingsphere/authority/distsql/handler/ShowAuthorityRuleExecutorTest.java index a2bd3782b40..1776e57b292 100644 --- a/kernel/authority/distsql/handler/src/test/java/org/apache/shardingsphere/authority/distsql/handler/ShowAuthorityRuleExecutorTest.java +++ b/kernel/authority/distsql/handler/src/test/java/org/apache/shardingsphere/authority/distsql/handler/ShowAuthorityRuleExecutorTest.java @@ -46,7 +46,7 @@ class ShowAuthorityRuleExecutorTest { void assertExecute() { ShardingSphereMetaData metaData = mockMetaData(); ShowAuthorityRuleExecutor executor = new ShowAuthorityRuleExecutor(); - Collection<LocalDataQueryResultRow> actual = executor.getRows(metaData, mock(ShowAuthorityRuleStatement.class)); + Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowAuthorityRuleStatement.class), metaData); assertThat(actual.size(), is(1)); Iterator<LocalDataQueryResultRow> iterator = actual.iterator(); LocalDataQueryResultRow row = iterator.next(); diff --git a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/handler/query/ShowStreamingJobStatusExecutor.java b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/handler/query/ShowStreamingJobStatusExecutor.java index 968a030cc0e..d4e31ea2308 100644 --- a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/handler/query/ShowStreamingJobStatusExecutor.java +++ b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/handler/query/ShowStreamingJobStatusExecutor.java @@ -25,6 +25,7 @@ import org.apache.shardingsphere.data.pipeline.core.job.progress.TransmissionJob import org.apache.shardingsphere.data.pipeline.core.pojo.TransmissionJobItemInfo; import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import java.util.Arrays; @@ -40,7 +41,7 @@ public final class ShowStreamingJobStatusExecutor implements QueryableRALExecuto private final CDCJobAPI jobAPI = (CDCJobAPI) TypedSPILoader.getService(TransmissionJobAPI.class, "STREAMING"); @Override - public Collection<LocalDataQueryResultRow> getRows(final ShowStreamingStatusStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowStreamingStatusStatement sqlStatement, final ShardingSphereMetaData metaData) { Collection<CDCJobItemInfo> jobItemInfos = jobAPI.getJobItemInfos(sqlStatement.getJobId()); long currentTimeMillis = System.currentTimeMillis(); return jobItemInfos.stream().map(each -> getRow(each, currentTimeMillis)).collect(Collectors.toList()); diff --git a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/handler/query/ShowStreamingListExecutor.java b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/handler/query/ShowStreamingListExecutor.java index 6f2d37c550f..ad5472befbd 100644 --- a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/handler/query/ShowStreamingListExecutor.java +++ b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/handler/query/ShowStreamingListExecutor.java @@ -24,6 +24,7 @@ import org.apache.shardingsphere.data.pipeline.core.job.service.PipelineJobManag import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.instance.metadata.InstanceType; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import java.util.Arrays; import java.util.Collection; @@ -38,7 +39,7 @@ public final class ShowStreamingListExecutor implements QueryableRALExecutor<Sho private final PipelineJobManager pipelineJobManager = new PipelineJobManager(new CDCJobType()); @Override - public Collection<LocalDataQueryResultRow> getRows(final ShowStreamingListStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowStreamingListStatement sqlStatement, final ShardingSphereMetaData metaData) { return pipelineJobManager.getJobInfos(new PipelineContextKey(InstanceType.PROXY)).stream().map(each -> new LocalDataQueryResultRow(each.getJobMetaData().getJobId(), each.getDatabaseName(), each.getTableName(), each.getJobMetaData().getJobItemCount(), each.getJobMetaData().isActive() ? Boolean.TRUE.toString() : Boolean.FALSE.toString(), diff --git a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/handler/query/ShowStreamingRuleExecutor.java b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/handler/query/ShowStreamingRuleExecutor.java index 3f344d8077d..adc0d23b538 100644 --- a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/handler/query/ShowStreamingRuleExecutor.java +++ b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/handler/query/ShowStreamingRuleExecutor.java @@ -21,6 +21,7 @@ import org.apache.shardingsphere.data.pipeline.cdc.distsql.statement.ShowStreami import org.apache.shardingsphere.data.pipeline.distsql.ShowTransmissionRuleQueryResult; import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import java.util.Collection; @@ -37,7 +38,7 @@ public final class ShowStreamingRuleExecutor implements QueryableRALExecutor<Sho } @Override - public Collection<LocalDataQueryResultRow> getRows(final ShowStreamingRuleStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowStreamingRuleStatement sqlStatement, final ShardingSphereMetaData metaData) { return queryResult.getRows(); } diff --git a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationCheckAlgorithmsExecutor.java b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationCheckAlgorithmsExecutor.java index 19f87364b81..77056ebe330 100644 --- a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationCheckAlgorithmsExecutor.java +++ b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationCheckAlgorithmsExecutor.java @@ -22,6 +22,7 @@ import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.distsql.handler.ral.query.algorithm.AlgorithmMetaDataQueryResultRows; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationCheckAlgorithmsStatement; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import java.util.Collection; @@ -33,7 +34,7 @@ public final class ShowMigrationCheckAlgorithmsExecutor implements QueryableRALE private final AlgorithmMetaDataQueryResultRows algorithmMetaDataQueryResultRows = new AlgorithmMetaDataQueryResultRows(TableDataConsistencyChecker.class); @Override - public Collection<LocalDataQueryResultRow> getRows(final ShowMigrationCheckAlgorithmsStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowMigrationCheckAlgorithmsStatement sqlStatement, final ShardingSphereMetaData metaData) { return algorithmMetaDataQueryResultRows.getRows(); } diff --git a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationCheckStatusExecutor.java b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationCheckStatusExecutor.java index 32c7a548397..4517536f668 100644 --- a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationCheckStatusExecutor.java +++ b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationCheckStatusExecutor.java @@ -23,6 +23,7 @@ import org.apache.shardingsphere.data.pipeline.scenario.consistencycheck.api.Con import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationCheckStatusStatement; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import java.util.Arrays; import java.util.Collection; @@ -38,7 +39,7 @@ public final class ShowMigrationCheckStatusExecutor implements QueryableRALExecu private final ConsistencyCheckJobAPI jobAPI = new ConsistencyCheckJobAPI(new ConsistencyCheckJobType()); @Override - public Collection<LocalDataQueryResultRow> getRows(final ShowMigrationCheckStatusStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowMigrationCheckStatusStatement sqlStatement, final ShardingSphereMetaData metaData) { List<ConsistencyCheckJobItemInfo> infos = jobAPI.getJobItemInfos(sqlStatement.getJobId()); Collection<LocalDataQueryResultRow> result = new LinkedList<>(); for (ConsistencyCheckJobItemInfo each : infos) { diff --git a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationJobStatusExecutor.java b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationJobStatusExecutor.java index 9865b8c86a0..ded849baa80 100644 --- a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationJobStatusExecutor.java +++ b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationJobStatusExecutor.java @@ -24,6 +24,7 @@ import org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobTy import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationStatusStatement; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import java.util.Arrays; import java.util.Collection; @@ -36,7 +37,7 @@ import java.util.stream.Collectors; public final class ShowMigrationJobStatusExecutor implements QueryableRALExecutor<ShowMigrationStatusStatement> { @Override - public Collection<LocalDataQueryResultRow> getRows(final ShowMigrationStatusStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowMigrationStatusStatement sqlStatement, final ShardingSphereMetaData metaData) { Collection<TransmissionJobItemInfo> jobItemInfos = new TransmissionJobManager(new MigrationJobType()).getJobItemInfos(sqlStatement.getJobId()); long currentTimeMillis = System.currentTimeMillis(); return jobItemInfos.stream().map(each -> getRow(each, currentTimeMillis)).collect(Collectors.toList()); diff --git a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationListExecutor.java b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationListExecutor.java index 2f99ad47a4d..d7df2e0ec7f 100644 --- a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationListExecutor.java +++ b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationListExecutor.java @@ -24,6 +24,7 @@ import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.instance.metadata.InstanceType; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationListStatement; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import java.util.Arrays; import java.util.Collection; @@ -37,7 +38,7 @@ public final class ShowMigrationListExecutor implements QueryableRALExecutor<Sho private final PipelineJobManager pipelineJobManager = new PipelineJobManager(new MigrationJobType()); @Override - public Collection<LocalDataQueryResultRow> getRows(final ShowMigrationListStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowMigrationListStatement sqlStatement, final ShardingSphereMetaData metaData) { return pipelineJobManager.getJobInfos(new PipelineContextKey(InstanceType.PROXY)).stream().map(each -> new LocalDataQueryResultRow(each.getJobMetaData().getJobId(), each.getTableName(), each.getJobMetaData().getJobItemCount(), each.getJobMetaData().isActive() ? Boolean.TRUE.toString() : Boolean.FALSE.toString(), diff --git a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationSourceStorageUnitsExecutor.java b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationSourceStorageUnitsExecutor.java index 385646aa1d6..6e50443fda2 100644 --- a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationSourceStorageUnitsExecutor.java +++ b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationSourceStorageUnitsExecutor.java @@ -23,6 +23,7 @@ import org.apache.shardingsphere.data.pipeline.scenario.migration.api.MigrationJ import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.instance.metadata.InstanceType; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationSourceStorageUnitsStatement; @@ -40,7 +41,7 @@ public final class ShowMigrationSourceStorageUnitsExecutor implements QueryableR private final MigrationJobAPI jobAPI = (MigrationJobAPI) TypedSPILoader.getService(TransmissionJobAPI.class, "MIGRATION"); @Override - public Collection<LocalDataQueryResultRow> getRows(final ShowMigrationSourceStorageUnitsStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowMigrationSourceStorageUnitsStatement sqlStatement, final ShardingSphereMetaData metaData) { Iterator<Collection<Object>> data = jobAPI.listMigrationSourceResources(new PipelineContextKey(InstanceType.PROXY)).iterator(); Collection<LocalDataQueryResultRow> result = new LinkedList<>(); while (data.hasNext()) { 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 19994a29254..7ff501456ee 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 @@ -17,12 +17,12 @@ package org.apache.shardingsphere.globalclock.distsql.handler.query; -import org.apache.shardingsphere.distsql.handler.ral.query.MetaDataRequiredQueryableRALExecutor; +import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; 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; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; -import org.apache.shardingsphere.globalclock.distsql.statement.queryable.ShowGlobalClockRuleStatement; import org.apache.shardingsphere.infra.props.PropertiesConverter; import java.util.Arrays; @@ -32,10 +32,10 @@ import java.util.Collections; /** * Show global clock rule executor. */ -public final class ShowGlobalClockRuleExecutor implements MetaDataRequiredQueryableRALExecutor<ShowGlobalClockRuleStatement> { +public final class ShowGlobalClockRuleExecutor implements QueryableRALExecutor<ShowGlobalClockRuleStatement> { @Override - public Collection<LocalDataQueryResultRow> getRows(final ShardingSphereMetaData metaData, final ShowGlobalClockRuleStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowGlobalClockRuleStatement sqlStatement, final ShardingSphereMetaData metaData) { GlobalClockRuleConfiguration ruleConfig = metaData.getGlobalRuleMetaData().getSingleRule(GlobalClockRule.class).getConfiguration(); return Collections.singleton(new LocalDataQueryResultRow(ruleConfig.getType(), ruleConfig.getProvider(), String.valueOf(ruleConfig.isEnabled()), PropertiesConverter.convert(ruleConfig.getProps()))); diff --git a/kernel/global-clock/distsql/handler/src/test/java/org/apache/shardingsphere/globalclock/distsql/handler/query/ShowGlobalClockRuleExecutorTest.java b/kernel/global-clock/distsql/handler/src/test/java/org/apache/shardingsphere/globalclock/distsql/handler/query/ShowGlobalClockRuleExecutorTest.java index 450fec66f8d..49b3effc6fd 100644 --- a/kernel/global-clock/distsql/handler/src/test/java/org/apache/shardingsphere/globalclock/distsql/handler/query/ShowGlobalClockRuleExecutorTest.java +++ b/kernel/global-clock/distsql/handler/src/test/java/org/apache/shardingsphere/globalclock/distsql/handler/query/ShowGlobalClockRuleExecutorTest.java @@ -46,7 +46,7 @@ class ShowGlobalClockRuleExecutorTest { void assertGlobalClockRule() { ShardingSphereMetaData metaData = mockMetaData(); ShowGlobalClockRuleExecutor executor = new ShowGlobalClockRuleExecutor(); - Collection<LocalDataQueryResultRow> actual = executor.getRows(metaData, mock(ShowGlobalClockRuleStatement.class)); + Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowGlobalClockRuleStatement.class), metaData); assertThat(actual.size(), is(1)); Iterator<LocalDataQueryResultRow> iterator = actual.iterator(); LocalDataQueryResultRow row = iterator.next(); 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 8ce03f8f060..9285c72a9de 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 @@ -17,7 +17,7 @@ package org.apache.shardingsphere.sqlfederation.distsql.handler.query; -import org.apache.shardingsphere.distsql.handler.ral.query.MetaDataRequiredQueryableRALExecutor; +import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.sqlfederation.api.config.SQLFederationRuleConfiguration; @@ -31,10 +31,10 @@ import java.util.Collections; /** * Show SQL federation rule executor. */ -public final class ShowSQLFederationRuleExecutor implements MetaDataRequiredQueryableRALExecutor<ShowSQLFederationRuleStatement> { +public final class ShowSQLFederationRuleExecutor implements QueryableRALExecutor<ShowSQLFederationRuleStatement> { @Override - public Collection<LocalDataQueryResultRow> getRows(final ShardingSphereMetaData metaData, final ShowSQLFederationRuleStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowSQLFederationRuleStatement sqlStatement, final ShardingSphereMetaData metaData) { SQLFederationRuleConfiguration ruleConfig = metaData.getGlobalRuleMetaData().getSingleRule(SQLFederationRule.class).getConfiguration(); String sqlFederationEnabled = String.valueOf(ruleConfig.isSqlFederationEnabled()); String allQueryUseSQLFederation = String.valueOf(ruleConfig.isAllQueryUseSQLFederation()); diff --git a/kernel/sql-federation/distsql/handler/src/test/java/org/apache/shardingsphere/sqlfederation/distsql/handler/query/ShowSQLFederationRuleExecutorTest.java b/kernel/sql-federation/distsql/handler/src/test/java/org/apache/shardingsphere/sqlfederation/distsql/handler/query/ShowSQLFederationRuleExecutorTest.java index 6d3c7b9f3bf..842528ac113 100644 --- a/kernel/sql-federation/distsql/handler/src/test/java/org/apache/shardingsphere/sqlfederation/distsql/handler/query/ShowSQLFederationRuleExecutorTest.java +++ b/kernel/sql-federation/distsql/handler/src/test/java/org/apache/shardingsphere/sqlfederation/distsql/handler/query/ShowSQLFederationRuleExecutorTest.java @@ -45,7 +45,7 @@ class ShowSQLFederationRuleExecutorTest { void assertSQLFederationRule() { ShardingSphereMetaData metaData = mockMetaData(); ShowSQLFederationRuleExecutor executor = new ShowSQLFederationRuleExecutor(); - Collection<LocalDataQueryResultRow> actual = executor.getRows(metaData, mock(ShowSQLFederationRuleStatement.class)); + Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowSQLFederationRuleStatement.class), metaData); assertThat(actual.size(), is(1)); Iterator<LocalDataQueryResultRow> iterator = actual.iterator(); LocalDataQueryResultRow row = iterator.next(); 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 e78cc184c21..0e1e4ec64b4 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 @@ -17,7 +17,7 @@ package org.apache.shardingsphere.parser.distsql.handler.query; -import org.apache.shardingsphere.distsql.handler.ral.query.MetaDataRequiredQueryableRALExecutor; +import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.parser.config.SQLParserRuleConfiguration; @@ -31,10 +31,10 @@ import java.util.Collections; /** * Show SQL parser rule executor. */ -public final class ShowSQLParserRuleExecutor implements MetaDataRequiredQueryableRALExecutor<ShowSQLParserRuleStatement> { +public final class ShowSQLParserRuleExecutor implements QueryableRALExecutor<ShowSQLParserRuleStatement> { @Override - public Collection<LocalDataQueryResultRow> getRows(final ShardingSphereMetaData metaData, final ShowSQLParserRuleStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowSQLParserRuleStatement sqlStatement, final ShardingSphereMetaData metaData) { SQLParserRuleConfiguration ruleConfig = metaData.getGlobalRuleMetaData().getSingleRule(SQLParserRule.class).getConfiguration(); return Collections.singleton(new LocalDataQueryResultRow(null != ruleConfig.getParseTreeCache() ? ruleConfig.getParseTreeCache().toString() : "", null != ruleConfig.getSqlStatementCache() ? ruleConfig.getSqlStatementCache().toString() : "")); diff --git a/kernel/sql-parser/distsql/handler/src/test/java/org/apache/shardingsphere/parser/distsql/handler/query/ShowSQLParserRuleExecutorTest.java b/kernel/sql-parser/distsql/handler/src/test/java/org/apache/shardingsphere/parser/distsql/handler/query/ShowSQLParserRuleExecutorTest.java index c0b0230eff7..15f1b9c002c 100644 --- a/kernel/sql-parser/distsql/handler/src/test/java/org/apache/shardingsphere/parser/distsql/handler/query/ShowSQLParserRuleExecutorTest.java +++ b/kernel/sql-parser/distsql/handler/src/test/java/org/apache/shardingsphere/parser/distsql/handler/query/ShowSQLParserRuleExecutorTest.java @@ -45,7 +45,7 @@ class ShowSQLParserRuleExecutorTest { void assertSQLParserRule() { ShardingSphereMetaData metaData = mockMetaData(); ShowSQLParserRuleExecutor executor = new ShowSQLParserRuleExecutor(); - Collection<LocalDataQueryResultRow> actual = executor.getRows(metaData, mock(ShowSQLParserRuleStatement.class)); + Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowSQLParserRuleStatement.class), metaData); assertThat(actual.size(), is(1)); Iterator<LocalDataQueryResultRow> iterator = actual.iterator(); LocalDataQueryResultRow row = iterator.next(); 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 7b1fbac8d25..a168fc5fde0 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 @@ -17,7 +17,7 @@ package org.apache.shardingsphere.sqltranslator.distsql.handler.query; -import org.apache.shardingsphere.distsql.handler.ral.query.MetaDataRequiredQueryableRALExecutor; +import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.props.PropertiesConverter; @@ -32,10 +32,10 @@ import java.util.Collections; /** * Show SQL translator rule executor. */ -public final class ShowSQLTranslatorRuleExecutor implements MetaDataRequiredQueryableRALExecutor<ShowSQLTranslatorRuleStatement> { +public final class ShowSQLTranslatorRuleExecutor implements QueryableRALExecutor<ShowSQLTranslatorRuleStatement> { @Override - public Collection<LocalDataQueryResultRow> getRows(final ShardingSphereMetaData metaData, final ShowSQLTranslatorRuleStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowSQLTranslatorRuleStatement sqlStatement, final ShardingSphereMetaData metaData) { SQLTranslatorRule rule = metaData.getGlobalRuleMetaData().getSingleRule(SQLTranslatorRule.class); return buildData(rule.getConfiguration()); } diff --git a/kernel/sql-translator/distsql/handler/src/test/java/org/apache/shardingsphere/sqltranslator/distsql/handler/query/ShowSQLTranslatorRuleExecutorTest.java b/kernel/sql-translator/distsql/handler/src/test/java/org/apache/shardingsphere/sqltranslator/distsql/handler/query/ShowSQLTranslatorRuleExecutorTest.java index f37354b1bab..1a1998daefc 100644 --- a/kernel/sql-translator/distsql/handler/src/test/java/org/apache/shardingsphere/sqltranslator/distsql/handler/query/ShowSQLTranslatorRuleExecutorTest.java +++ b/kernel/sql-translator/distsql/handler/src/test/java/org/apache/shardingsphere/sqltranslator/distsql/handler/query/ShowSQLTranslatorRuleExecutorTest.java @@ -44,7 +44,7 @@ class ShowSQLTranslatorRuleExecutorTest { void assertExecute() { ShardingSphereMetaData metaData = mockMetaData(); ShowSQLTranslatorRuleExecutor executor = new ShowSQLTranslatorRuleExecutor(); - Collection<LocalDataQueryResultRow> actual = executor.getRows(metaData, mock(ShowSQLTranslatorRuleStatement.class)); + Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowSQLTranslatorRuleStatement.class), metaData); assertThat(actual.size(), is(1)); Iterator<LocalDataQueryResultRow> iterator = actual.iterator(); LocalDataQueryResultRow row = iterator.next(); 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 6d6c7e7865d..623f3f25bee 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 @@ -17,7 +17,7 @@ package org.apache.shardingsphere.traffic.distsql.handler.query; -import org.apache.shardingsphere.distsql.handler.ral.query.MetaDataRequiredQueryableRALExecutor; +import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; @@ -34,10 +34,10 @@ import java.util.LinkedList; /** * Show traffic rule executor. */ -public final class ShowTrafficRuleExecutor implements MetaDataRequiredQueryableRALExecutor<ShowTrafficRulesStatement> { +public final class ShowTrafficRuleExecutor implements QueryableRALExecutor<ShowTrafficRulesStatement> { @Override - public Collection<LocalDataQueryResultRow> getRows(final ShardingSphereMetaData metaData, final ShowTrafficRulesStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowTrafficRulesStatement sqlStatement, final ShardingSphereMetaData metaData) { TrafficRule rule = metaData.getGlobalRuleMetaData().getSingleRule(TrafficRule.class); return buildData(rule.getConfiguration(), sqlStatement.getRuleName()); } diff --git a/kernel/traffic/distsql/handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/query/ShowTrafficRuleExecutorTest.java b/kernel/traffic/distsql/handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/query/ShowTrafficRuleExecutorTest.java index 0fc8570d3f4..700d295946f 100644 --- a/kernel/traffic/distsql/handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/query/ShowTrafficRuleExecutorTest.java +++ b/kernel/traffic/distsql/handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/query/ShowTrafficRuleExecutorTest.java @@ -49,7 +49,7 @@ class ShowTrafficRuleExecutorTest { void assertExecute() { ShardingSphereMetaData metaData = mockMetaData(); ShowTrafficRuleExecutor executor = new ShowTrafficRuleExecutor(); - Collection<LocalDataQueryResultRow> actual = executor.getRows(metaData, mock(ShowTrafficRulesStatement.class)); + Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowTrafficRulesStatement.class), metaData); assertThat(actual.size(), is(2)); Iterator<LocalDataQueryResultRow> iterator = actual.iterator(); LocalDataQueryResultRow row = iterator.next(); 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 952b6089e8d..89ef81b7c3d 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 @@ -17,7 +17,7 @@ package org.apache.shardingsphere.transaction.distsql.handler.query; -import org.apache.shardingsphere.distsql.handler.ral.query.MetaDataRequiredQueryableRALExecutor; +import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.props.PropertiesConverter; @@ -31,10 +31,10 @@ import java.util.Collections; /** * Show transaction rule executor. */ -public final class ShowTransactionRuleExecutor implements MetaDataRequiredQueryableRALExecutor<ShowTransactionRuleStatement> { +public final class ShowTransactionRuleExecutor implements QueryableRALExecutor<ShowTransactionRuleStatement> { @Override - public Collection<LocalDataQueryResultRow> getRows(final ShardingSphereMetaData metaData, final ShowTransactionRuleStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowTransactionRuleStatement sqlStatement, final ShardingSphereMetaData metaData) { TransactionRule rule = metaData.getGlobalRuleMetaData().getSingleRule(TransactionRule.class); return Collections.singleton(new LocalDataQueryResultRow(rule.getDefaultType().name(), null != rule.getProviderType() ? rule.getProviderType() : "", rule.getProps().isEmpty() ? "" : PropertiesConverter.convert(rule.getProps()))); diff --git a/kernel/transaction/distsql/handler/src/test/java/org/apache/shardingsphere/transaction/distsql/handler/query/ShowTransactionRuleExecutorTest.java b/kernel/transaction/distsql/handler/src/test/java/org/apache/shardingsphere/transaction/distsql/handler/query/ShowTransactionRuleExecutorTest.java index 3853f35528f..338c0f294ef 100644 --- a/kernel/transaction/distsql/handler/src/test/java/org/apache/shardingsphere/transaction/distsql/handler/query/ShowTransactionRuleExecutorTest.java +++ b/kernel/transaction/distsql/handler/src/test/java/org/apache/shardingsphere/transaction/distsql/handler/query/ShowTransactionRuleExecutorTest.java @@ -49,7 +49,7 @@ class ShowTransactionRuleExecutorTest { RuleMetaData ruleMetaData = mockGlobalRuleMetaData(TransactionType.XA.name(), "Atomikos", PropertiesBuilder.build(new Property("host", "127.0.0.1"), new Property("databaseName", "jbossts"))); ShardingSphereMetaData metaData = new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ResourceMetaData.class), ruleMetaData, new ConfigurationProperties(new Properties())); - Collection<LocalDataQueryResultRow> actual = executor.getRows(metaData, mock(ShowTransactionRuleStatement.class)); + Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowTransactionRuleStatement.class), metaData); assertThat(actual.size(), is(1)); Iterator<LocalDataQueryResultRow> iterator = actual.iterator(); LocalDataQueryResultRow row = iterator.next(); @@ -65,7 +65,7 @@ class ShowTransactionRuleExecutorTest { ShowTransactionRuleExecutor executor = new ShowTransactionRuleExecutor(); RuleMetaData ruleMetaData = mockGlobalRuleMetaData(TransactionType.LOCAL.name(), null, new Properties()); ShardingSphereMetaData metaData = new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ResourceMetaData.class), ruleMetaData, new ConfigurationProperties(new Properties())); - Collection<LocalDataQueryResultRow> actual = executor.getRows(metaData, mock(ShowTransactionRuleStatement.class)); + Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowTransactionRuleStatement.class), metaData); assertThat(actual.size(), is(1)); Iterator<LocalDataQueryResultRow> iterator = actual.iterator(); LocalDataQueryResultRow row = iterator.next(); diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/QueryableRALBackendHandler.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/QueryableRALBackendHandler.java index dac740ff429..b4dfd60d7af 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/QueryableRALBackendHandler.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/QueryableRALBackendHandler.java @@ -17,18 +17,18 @@ package org.apache.shardingsphere.proxy.backend.handler.distsql.ral; -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.distsql.handler.ral.query.DatabaseRequiredQueryableRALExecutor; import org.apache.shardingsphere.distsql.handler.ral.query.InstanceContextRequiredQueryableRALExecutor; -import org.apache.shardingsphere.distsql.handler.ral.query.MetaDataRequiredQueryableRALExecutor; import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.distsql.statement.ral.QueryableRALStatement; +import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; +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.MergedResult; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataMergedResult; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; -import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; +import org.apache.shardingsphere.mode.manager.ContextManager; import org.apache.shardingsphere.proxy.backend.context.ProxyContext; import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.executor.ConnectionSessionRequiredQueryableRALExecutor; import org.apache.shardingsphere.proxy.backend.response.data.QueryResponseCell; @@ -82,26 +82,20 @@ public final class QueryableRALBackendHandler<T extends QueryableRALStatement> i if (executor instanceof InstanceContextRequiredQueryableRALExecutor) { return getMergedResultByInstanceContextRequiredExecutor((InstanceContextRequiredQueryableRALExecutor<T>) executor); } - if (executor instanceof MetaDataRequiredQueryableRALExecutor) { - return getMergedResultByMetaDataRequiredExecutor((MetaDataRequiredQueryableRALExecutor<T>) executor); - } if (executor instanceof DatabaseRequiredQueryableRALExecutor) { return getMergedResultByDatabaseRequiredExecutor((DatabaseRequiredQueryableRALExecutor<T>) executor); } if (executor instanceof ConnectionSessionRequiredQueryableRALExecutor) { return getMergedResultByConnectionSessionRequiredExecutor((ConnectionSessionRequiredQueryableRALExecutor<T>) executor); } - return createMergedResult(executor.getRows(sqlStatement)); + ContextManager contextManager = ProxyContext.getInstance().getContextManager(); + return createMergedResult(executor.getRows(sqlStatement, contextManager.getMetaDataContexts().getMetaData())); } private MergedResult getMergedResultByInstanceContextRequiredExecutor(final InstanceContextRequiredQueryableRALExecutor<T> executor) { return createMergedResult(executor.getRows(ProxyContext.getInstance().getContextManager().getInstanceContext(), sqlStatement)); } - private MergedResult getMergedResultByMetaDataRequiredExecutor(final MetaDataRequiredQueryableRALExecutor<T> executor) { - return createMergedResult(executor.getRows(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData(), sqlStatement)); - } - private MergedResult getMergedResultByDatabaseRequiredExecutor(final DatabaseRequiredQueryableRALExecutor<T> executor) { String databaseName = getDatabaseName(connectionSession, sqlStatement); checkDatabaseName(databaseName); diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java index a804b85f8e3..bdcdf4ae722 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java @@ -31,6 +31,7 @@ import org.apache.shardingsphere.infra.datasource.pool.props.creator.DataSourceP import org.apache.shardingsphere.infra.datasource.pool.props.domain.custom.CustomDataSourcePoolProperties; import org.apache.shardingsphere.infra.datasource.pool.props.domain.synonym.PoolPropertySynonyms; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.infra.util.yaml.YamlEngine; @@ -64,7 +65,7 @@ public final class ConvertYamlConfigurationExecutor implements QueryableRALExecu } @Override - public Collection<LocalDataQueryResultRow> getRows(final ConvertYamlConfigurationStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ConvertYamlConfigurationStatement sqlStatement, final ShardingSphereMetaData metaData) { File file = new File(sqlStatement.getFilePath()); YamlProxyDatabaseConfiguration yamlConfig; try { diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutor.java index 3f41820f9d9..200cae06fd4 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutor.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutor.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable; import org.apache.commons.codec.binary.Base64; -import org.apache.shardingsphere.distsql.handler.ral.query.MetaDataRequiredQueryableRALExecutor; +import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.distsql.statement.ral.queryable.ExportMetaDataStatement; import org.apache.shardingsphere.globalclock.core.provider.GlobalClockProvider; import org.apache.shardingsphere.globalclock.core.rule.GlobalClockRule; @@ -49,7 +49,7 @@ import java.util.Properties; /** * Export metadata executor. */ -public final class ExportMetaDataExecutor implements MetaDataRequiredQueryableRALExecutor<ExportMetaDataStatement> { +public final class ExportMetaDataExecutor implements QueryableRALExecutor<ExportMetaDataStatement> { @Override public Collection<String> getColumnNames() { @@ -57,7 +57,7 @@ public final class ExportMetaDataExecutor implements MetaDataRequiredQueryableRA } @Override - public Collection<LocalDataQueryResultRow> getRows(final ShardingSphereMetaData metaData, final ExportMetaDataStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ExportMetaDataStatement sqlStatement, final ShardingSphereMetaData metaData) { String exportedData = generateExportData(metaData); if (sqlStatement.getFilePath().isPresent()) { String filePath = sqlStatement.getFilePath().get(); diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutor.java index fa7930fc26e..b532449c94e 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutor.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutor.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable; -import org.apache.shardingsphere.distsql.handler.ral.query.MetaDataRequiredQueryableRALExecutor; +import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.distsql.statement.ral.queryable.ExportStorageNodesStatement; import org.apache.shardingsphere.infra.database.core.connector.ConnectionProperties; import org.apache.shardingsphere.infra.datasource.pool.props.creator.DataSourcePoolPropertiesCreator; @@ -43,7 +43,7 @@ import java.util.Map.Entry; /** * Export storage nodes executor. */ -public final class ExportStorageNodesExecutor implements MetaDataRequiredQueryableRALExecutor<ExportStorageNodesStatement> { +public final class ExportStorageNodesExecutor implements QueryableRALExecutor<ExportStorageNodesStatement> { @Override public Collection<String> getColumnNames() { @@ -51,7 +51,7 @@ public final class ExportStorageNodesExecutor implements MetaDataRequiredQueryab } @Override - public Collection<LocalDataQueryResultRow> getRows(final ShardingSphereMetaData metaData, final ExportStorageNodesStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ExportStorageNodesStatement sqlStatement, final ShardingSphereMetaData metaData) { checkSQLStatement(metaData, sqlStatement); String exportedData = generateExportData(metaData, sqlStatement); if (sqlStatement.getFilePath().isPresent()) { diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowKeyGenerateAlgorithmImplementationsExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowKeyGenerateAlgorithmImplementationsExecutor.java index d5bc6cc888f..dd017c85e1f 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowKeyGenerateAlgorithmImplementationsExecutor.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowKeyGenerateAlgorithmImplementationsExecutor.java @@ -20,6 +20,7 @@ package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable; import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.distsql.statement.ral.queryable.ShowKeyGenerateAlgorithmImplementationsStatement; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader; import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm; @@ -38,7 +39,7 @@ public final class ShowKeyGenerateAlgorithmImplementationsExecutor implements Qu } @Override - public Collection<LocalDataQueryResultRow> getRows(final ShowKeyGenerateAlgorithmImplementationsStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowKeyGenerateAlgorithmImplementationsStatement sqlStatement, final ShardingSphereMetaData metaData) { Collection<LocalDataQueryResultRow> result = new LinkedList<>(); Collection<KeyGenerateAlgorithm> keyGenerateAlgorithms = ShardingSphereServiceLoader.getServiceInstances(KeyGenerateAlgorithm.class); for (KeyGenerateAlgorithm each : keyGenerateAlgorithms) { diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowMigrationRuleExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowMigrationRuleExecutor.java index 55e6f574df1..de2926fac55 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowMigrationRuleExecutor.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowMigrationRuleExecutor.java @@ -21,6 +21,7 @@ import org.apache.shardingsphere.data.pipeline.distsql.ShowTransmissionRuleQuery import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.distsql.statement.ral.queryable.ShowMigrationRuleStatement; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import java.util.Collection; @@ -37,7 +38,7 @@ public final class ShowMigrationRuleExecutor implements QueryableRALExecutor<Sho } @Override - public Collection<LocalDataQueryResultRow> getRows(final ShowMigrationRuleStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowMigrationRuleStatement sqlStatement, final ShardingSphereMetaData metaData) { return queryResult.getRows(); } diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowServiceProviderImplementationsExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowServiceProviderImplementationsExecutor.java index dc666166ebc..daef9a8960e 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowServiceProviderImplementationsExecutor.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowServiceProviderImplementationsExecutor.java @@ -20,6 +20,7 @@ package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable; import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.distsql.statement.ral.queryable.ShowServiceProviderImplementationsStatement; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPI; import org.apache.shardingsphere.proxy.backend.exception.InvalidValueException; @@ -39,7 +40,7 @@ public final class ShowServiceProviderImplementationsExecutor implements Queryab } @Override - public Collection<LocalDataQueryResultRow> getRows(final ShowServiceProviderImplementationsStatement sqlStatement) { + public Collection<LocalDataQueryResultRow> getRows(final ShowServiceProviderImplementationsStatement sqlStatement, final ShardingSphereMetaData metaData) { Collection<LocalDataQueryResultRow> result = new LinkedList<>(); for (Object each : ShardingSphereServiceLoader.getServiceInstances(getServiceProviderImplementationClass(sqlStatement))) { TypedSPI implementation = (TypedSPI) each; diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutorTest.java index a9d11d82cce..229f3f0d25a 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutorTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutorTest.java @@ -22,6 +22,7 @@ import lombok.SneakyThrows; import org.apache.shardingsphere.distsql.statement.ral.queryable.ConvertYamlConfigurationStatement; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.parser.rule.SQLParserRule; import org.apache.shardingsphere.parser.rule.builder.DefaultSQLParserRuleConfigurationBuilder; @@ -37,6 +38,7 @@ import java.util.Objects; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.mockito.Mockito.mock; class ConvertYamlConfigurationExecutorTest { @@ -84,7 +86,7 @@ class ConvertYamlConfigurationExecutorTest { private void assertExecute(final String configFilePath, final String expectedFilePath) { ConvertYamlConfigurationExecutor executor = new ConvertYamlConfigurationExecutor(); Collection<LocalDataQueryResultRow> actual = executor.getRows( - new ConvertYamlConfigurationStatement(Objects.requireNonNull(ConvertYamlConfigurationExecutorTest.class.getResource(configFilePath)).getPath())); + new ConvertYamlConfigurationStatement(Objects.requireNonNull(ConvertYamlConfigurationExecutorTest.class.getResource(configFilePath)).getPath()), mock(ShardingSphereMetaData.class)); assertRowData(actual, expectedFilePath); } diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutorTest.java index 7ddd7bf5dca..21f8ff7ba5d 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutorTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutorTest.java @@ -129,7 +129,7 @@ class ExportMetaDataExecutorTest { when(database.getResourceMetaData().getStorageUnits()).thenReturn(Collections.emptyMap()); when(database.getRuleMetaData().getConfigurations()).thenReturn(Collections.emptyList()); ExportMetaDataStatement sqlStatement = new ExportMetaDataStatement(null); - Collection<LocalDataQueryResultRow> actual = new ExportMetaDataExecutor().getRows(contextManager.getMetaDataContexts().getMetaData(), sqlStatement); + Collection<LocalDataQueryResultRow> actual = new ExportMetaDataExecutor().getRows(sqlStatement, contextManager.getMetaDataContexts().getMetaData()); assertThat(actual.size(), is(1)); LocalDataQueryResultRow row = actual.iterator().next(); assertMetaData(row.getCell(3), EXPECTED_EMPTY_METADATA_VALUE); @@ -156,7 +156,7 @@ class ExportMetaDataExecutorTest { when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager); when(ProxyContext.getInstance().getAllDatabaseNames()).thenReturn(Collections.singleton("normal_db")); when(ProxyContext.getInstance().getDatabase("normal_db")).thenReturn(database); - Collection<LocalDataQueryResultRow> actual = new ExportMetaDataExecutor().getRows(contextManager.getMetaDataContexts().getMetaData(), new ExportMetaDataStatement(null)); + Collection<LocalDataQueryResultRow> actual = new ExportMetaDataExecutor().getRows(new ExportMetaDataStatement(null), contextManager.getMetaDataContexts().getMetaData()); assertThat(actual.size(), is(1)); LocalDataQueryResultRow row = actual.iterator().next(); assertMetaData(row.getCell(3), EXPECTED_NOT_EMPTY_METADATA_VALUE); diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutorTest.java index b69d0837316..11c604506f4 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutorTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutorTest.java @@ -103,7 +103,7 @@ class ExportStorageNodesExecutorTest { when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager); when(ProxyContext.getInstance().getAllDatabaseNames()).thenReturn(Collections.singleton("empty_metadata")); ExportStorageNodesStatement sqlStatement = new ExportStorageNodesStatement("foo", null); - assertThrows(IllegalArgumentException.class, () -> new ExportStorageNodesExecutor().getRows(contextManager.getMetaDataContexts().getMetaData(), sqlStatement)); + assertThrows(IllegalArgumentException.class, () -> new ExportStorageNodesExecutor().getRows(sqlStatement, contextManager.getMetaDataContexts().getMetaData())); } @Test @@ -112,7 +112,7 @@ class ExportStorageNodesExecutorTest { when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager); when(ProxyContext.getInstance().getAllDatabaseNames()).thenReturn(Collections.singleton("empty_metadata")); ExportStorageNodesStatement sqlStatement = new ExportStorageNodesStatement(null, null); - Collection<LocalDataQueryResultRow> actual = new ExportStorageNodesExecutor().getRows(contextManager.getMetaDataContexts().getMetaData(), sqlStatement); + Collection<LocalDataQueryResultRow> actual = new ExportStorageNodesExecutor().getRows(sqlStatement, contextManager.getMetaDataContexts().getMetaData()); assertThat(actual.size(), is(1)); LocalDataQueryResultRow row = actual.iterator().next(); assertThat(row.getCell(3), is("{\"storage_nodes\":{}}")); @@ -134,7 +134,7 @@ class ExportStorageNodesExecutorTest { when(database.getRuleMetaData().getConfigurations()).thenReturn(Collections.singleton(createShardingRuleConfiguration())); ContextManager contextManager = mockContextManager(); when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager); - Collection<LocalDataQueryResultRow> actual = new ExportStorageNodesExecutor().getRows(contextManager.getMetaDataContexts().getMetaData(), new ExportStorageNodesStatement(null, null)); + Collection<LocalDataQueryResultRow> actual = new ExportStorageNodesExecutor().getRows(new ExportStorageNodesStatement(null, null), contextManager.getMetaDataContexts().getMetaData()); assertThat(actual.size(), is(1)); LocalDataQueryResultRow row = actual.iterator().next(); assertThat(row.getCell(3), is(loadExpectedRow())); @@ -148,7 +148,7 @@ class ExportStorageNodesExecutorTest { when(database.getRuleMetaData().getConfigurations()).thenReturn(Collections.singleton(createShardingRuleConfiguration())); ContextManager contextManager = mockContextManager(); when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager); - Collection<LocalDataQueryResultRow> actual = new ExportStorageNodesExecutor().getRows(contextManager.getMetaDataContexts().getMetaData(), new ExportStorageNodesStatement("normal_db", null)); + Collection<LocalDataQueryResultRow> actual = new ExportStorageNodesExecutor().getRows(new ExportStorageNodesStatement("normal_db", null), contextManager.getMetaDataContexts().getMetaData()); assertThat(actual.size(), is(1)); LocalDataQueryResultRow row = actual.iterator().next(); assertThat(row.getCell(3), is(loadExpectedRow())); diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowKeyGenerateAlgorithmImplementationsExecutorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowKeyGenerateAlgorithmImplementationsExecutorTest.java index f8a6e87ea36..7f12968426f 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowKeyGenerateAlgorithmImplementationsExecutorTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowKeyGenerateAlgorithmImplementationsExecutorTest.java @@ -20,6 +20,7 @@ package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable; import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.distsql.statement.ral.queryable.ShowKeyGenerateAlgorithmImplementationsStatement; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.junit.jupiter.api.Test; import java.util.Collection; @@ -35,7 +36,7 @@ class ShowKeyGenerateAlgorithmImplementationsExecutorTest { @Test void assertGetRowData() { QueryableRALExecutor<ShowKeyGenerateAlgorithmImplementationsStatement> executor = new ShowKeyGenerateAlgorithmImplementationsExecutor(); - Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowKeyGenerateAlgorithmImplementationsStatement.class)); + Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowKeyGenerateAlgorithmImplementationsStatement.class), mock(ShardingSphereMetaData.class)); assertFalse(actual.isEmpty()); Iterator<LocalDataQueryResultRow> iterator = actual.iterator(); LocalDataQueryResultRow row = iterator.next(); diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowServiceProviderImplementationsExecutorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowServiceProviderImplementationsExecutorTest.java index e8e10185d8f..e22b7610693 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowServiceProviderImplementationsExecutorTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowServiceProviderImplementationsExecutorTest.java @@ -20,6 +20,7 @@ package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable; import org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor; import org.apache.shardingsphere.distsql.statement.ral.queryable.ShowServiceProviderImplementationsStatement; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.junit.jupiter.api.Test; import java.util.Collection; @@ -38,7 +39,7 @@ class ShowServiceProviderImplementationsExecutorTest { QueryableRALExecutor<ShowServiceProviderImplementationsStatement> executor = new ShowServiceProviderImplementationsExecutor(); ShowServiceProviderImplementationsStatement statement = mock(ShowServiceProviderImplementationsStatement.class); when(statement.getServiceProviderInterface()).thenReturn("org.apache.shardingsphere.infra.datasource.pool.destroyer.DataSourcePoolActiveDetector"); - Collection<LocalDataQueryResultRow> actual = executor.getRows(statement); + Collection<LocalDataQueryResultRow> actual = executor.getRows(statement, mock(ShardingSphereMetaData.class)); assertFalse(actual.isEmpty()); Iterator<LocalDataQueryResultRow> iterator = actual.iterator(); LocalDataQueryResultRow row = iterator.next();