This is an automated email from the ASF dual-hosted git repository.
jianglongtao 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 eb2bed80670 refactor "SHOW KEY GENERATE ALGORITHM IMPLEMENTATIONS"
module (#29395)
eb2bed80670 is described below
commit eb2bed80670b178eab993c7385bc7a6accacc083
Author: Zonglei Dong <[email protected]>
AuthorDate: Wed Dec 13 18:51:55 2023 +0800
refactor "SHOW KEY GENERATE ALGORITHM IMPLEMENTATIONS" module (#29395)
---
....distsql.handler.ral.query.QueryableRALExecutor | 1 -
.../src/main/antlr4/imports/sharding/Keyword.g4 | 4 ----
.../main/antlr4/imports/sharding/RALStatement.g4 | 4 ----
.../parser/autogen/ShardingDistSQLStatement.g4 | 1 -
.../core/ShardingDistSQLStatementVisitor.java | 7 ------
.../engine/src/main/antlr4/imports/Keyword.g4 | 12 +++++++++++
.../engine/src/main/antlr4/imports/RALStatement.g4 | 4 ++++
.../parser/autogen/KernelDistSQLStatement.g4 | 1 +
.../core/kernel/KernelDistSQLStatementVisitor.java | 7 ++++++
...yGenerateAlgorithmImplementationsStatement.java | 6 +++---
...eyGenerateAlgorithmImplementationsExecutor.java | 14 ++++++------
....distsql.handler.ral.query.QueryableRALExecutor | 1 +
...KeyGenerateAlgorithmImplementationsFixture.java | 25 ++++++++++++++++------
...nerateAlgorithmImplementationsExecutorTest.java | 21 ++++++++----------
...here.keygen.core.algorithm.KeyGenerateAlgorithm | 3 +--
15 files changed, 64 insertions(+), 47 deletions(-)
diff --git
a/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor
b/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor
index 63593d3b8b1..79ba98c3e8f 100644
---
a/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor
+++
b/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor
@@ -16,4 +16,3 @@
#
org.apache.shardingsphere.sharding.distsql.handler.query.ShowShardingAlgorithmImplementationsExecutor
-org.apache.shardingsphere.sharding.distsql.handler.query.ShowShardingKeyGenerateAlgorithmImplementationsExecutor
diff --git
a/features/sharding/distsql/parser/src/main/antlr4/imports/sharding/Keyword.g4
b/features/sharding/distsql/parser/src/main/antlr4/imports/sharding/Keyword.g4
index 3eb8c752e09..1649f15fd07 100644
---
a/features/sharding/distsql/parser/src/main/antlr4/imports/sharding/Keyword.g4
+++
b/features/sharding/distsql/parser/src/main/antlr4/imports/sharding/Keyword.g4
@@ -282,7 +282,3 @@ NONE
IMPLEMENTATIONS
: I M P L E M E N T A T I O N S
;
-
-GENERATE
- : G E N E R A T E
- ;
diff --git
a/features/sharding/distsql/parser/src/main/antlr4/imports/sharding/RALStatement.g4
b/features/sharding/distsql/parser/src/main/antlr4/imports/sharding/RALStatement.g4
index 9f0a3cbd317..b21e64d015b 100644
---
a/features/sharding/distsql/parser/src/main/antlr4/imports/sharding/RALStatement.g4
+++
b/features/sharding/distsql/parser/src/main/antlr4/imports/sharding/RALStatement.g4
@@ -22,7 +22,3 @@ import BaseRule;
showShardingAlgorithmImplementations
: SHOW SHARDING ALGORITHM IMPLEMENTATIONS
;
-
-showShardingKeyGenerateAlgorithmImplementations
- : SHOW SHARDING KEY GENERATE ALGORITHM IMPLEMENTATIONS
- ;
diff --git
a/features/sharding/distsql/parser/src/main/antlr4/sharding/org/apache/shardingsphere/distsql/parser/autogen/ShardingDistSQLStatement.g4
b/features/sharding/distsql/parser/src/main/antlr4/sharding/org/apache/shardingsphere/distsql/parser/autogen/ShardingDistSQLStatement.g4
index a7574f8b395..e19fa5cd9e2 100644
---
a/features/sharding/distsql/parser/src/main/antlr4/sharding/org/apache/shardingsphere/distsql/parser/autogen/ShardingDistSQLStatement.g4
+++
b/features/sharding/distsql/parser/src/main/antlr4/sharding/org/apache/shardingsphere/distsql/parser/autogen/ShardingDistSQLStatement.g4
@@ -47,6 +47,5 @@ execute
| showUnusedShardingAuditors
| countShardingRule
| showShardingAlgorithmImplementations
- | showShardingKeyGenerateAlgorithmImplementations
) SEMI_? EOF
;
diff --git
a/features/sharding/distsql/parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
b/features/sharding/distsql/parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
index adf578acb81..8e655c3ecdb 100644
---
a/features/sharding/distsql/parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
+++
b/features/sharding/distsql/parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
@@ -50,7 +50,6 @@ import
org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatement
import
org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.ShowShardingAlgorithmsContext;
import
org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.ShowShardingAuditorsContext;
import
org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.ShowShardingKeyGeneratorsContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.ShowShardingKeyGenerateAlgorithmImplementationsContext;
import
org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.ShowShardingTableNodesContext;
import
org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.ShowShardingTableReferenceRulesContext;
import
org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.ShowShardingTableRulesContext;
@@ -90,7 +89,6 @@ import
org.apache.shardingsphere.sharding.distsql.statement.ShowDefaultShardingS
import
org.apache.shardingsphere.sharding.distsql.statement.ShowShardingAlgorithmImplementationsStatement;
import
org.apache.shardingsphere.sharding.distsql.statement.ShowShardingAlgorithmsStatement;
import
org.apache.shardingsphere.sharding.distsql.statement.ShowShardingAuditorsStatement;
-import
org.apache.shardingsphere.sharding.distsql.statement.ShowShardingKeyGenerateAlgorithmImplementationsStatement;
import
org.apache.shardingsphere.sharding.distsql.statement.ShowShardingKeyGeneratorsStatement;
import
org.apache.shardingsphere.sharding.distsql.statement.ShowShardingTableNodesStatement;
import
org.apache.shardingsphere.sharding.distsql.statement.ShowShardingTableReferenceRulesStatement;
@@ -409,9 +407,4 @@ public final class ShardingDistSQLStatementVisitor extends
ShardingDistSQLStatem
public ASTNode visitShowShardingAlgorithmImplementations(final
ShowShardingAlgorithmImplementationsContext ctx) {
return new ShowShardingAlgorithmImplementationsStatement();
}
-
- @Override
- public ASTNode visitShowShardingKeyGenerateAlgorithmImplementations(final
ShowShardingKeyGenerateAlgorithmImplementationsContext ctx) {
- return new ShowShardingKeyGenerateAlgorithmImplementationsStatement();
- }
}
diff --git a/parser/distsql/engine/src/main/antlr4/imports/Keyword.g4
b/parser/distsql/engine/src/main/antlr4/imports/Keyword.g4
index a12f065658f..29b1428edcb 100644
--- a/parser/distsql/engine/src/main/antlr4/imports/Keyword.g4
+++ b/parser/distsql/engine/src/main/antlr4/imports/Keyword.g4
@@ -354,3 +354,15 @@ IMPLEMENTATIONS
OF
: O F
;
+
+KEY
+ : K E Y
+ ;
+
+GENERATE
+ : G E N E R A T E
+ ;
+
+ALGORITHM
+ : A L G O R I T H M
+ ;
diff --git a/parser/distsql/engine/src/main/antlr4/imports/RALStatement.g4
b/parser/distsql/engine/src/main/antlr4/imports/RALStatement.g4
index ba93cc20e24..a6beedb0fd4 100644
--- a/parser/distsql/engine/src/main/antlr4/imports/RALStatement.g4
+++ b/parser/distsql/engine/src/main/antlr4/imports/RALStatement.g4
@@ -119,6 +119,10 @@ showServiceProviderImplementations
: SHOW IMPLEMENTATIONS OF serviceProviderInterface
;
+showKeyGenerateAlgorithmImplementations
+ : SHOW KEY GENERATE ALGORITHM IMPLEMENTATIONS
+ ;
+
transmissionRule
: LP_ readDefinition? (COMMA_? writeDefinition)? (COMMA_? streamChannel)?
RP_
;
diff --git
a/parser/distsql/engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
b/parser/distsql/engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
index 30000d0f6d6..5b1bf9a89cf 100644
---
a/parser/distsql/engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
+++
b/parser/distsql/engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
@@ -51,5 +51,6 @@ execute
| lockCluster
| unlockCluster
| showServiceProviderImplementations
+ | showKeyGenerateAlgorithmImplementations
) SEMI_? EOF
;
diff --git
a/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
b/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
index 146ba47be60..f132ba3ab87 100644
---
a/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
+++
b/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
@@ -56,6 +56,7 @@ import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementPa
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowDistVariableContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowDistVariablesContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowLogicalTablesContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowKeyGenerateAlgorithmImplementationsContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowMigrationRuleContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowRulesUsedStorageUnitContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowServiceProviderImplementationsContext;
@@ -84,6 +85,7 @@ import
org.apache.shardingsphere.distsql.statement.ral.queryable.ShowComputeNode
import
org.apache.shardingsphere.distsql.statement.ral.queryable.ShowComputeNodesStatement;
import
org.apache.shardingsphere.distsql.statement.ral.queryable.ShowDistVariableStatement;
import
org.apache.shardingsphere.distsql.statement.ral.queryable.ShowDistVariablesStatement;
+import
org.apache.shardingsphere.distsql.statement.ral.queryable.ShowKeyGenerateAlgorithmImplementationsStatement;
import
org.apache.shardingsphere.distsql.statement.ral.queryable.ShowMigrationRuleStatement;
import
org.apache.shardingsphere.distsql.statement.ral.queryable.ShowServiceProviderImplementationsStatement;
import
org.apache.shardingsphere.distsql.statement.ral.queryable.ShowTableMetaDataStatement;
@@ -408,4 +410,9 @@ public final class KernelDistSQLStatementVisitor extends
KernelDistSQLStatementB
public ASTNode visitShowServiceProviderImplementations(final
ShowServiceProviderImplementationsContext ctx) {
return new
ShowServiceProviderImplementationsStatement(getIdentifierValue(ctx.serviceProviderInterface()));
}
+
+ @Override
+ public ASTNode visitShowKeyGenerateAlgorithmImplementations(final
ShowKeyGenerateAlgorithmImplementationsContext ctx) {
+ return new ShowKeyGenerateAlgorithmImplementationsStatement();
+ }
}
diff --git
a/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/statement/ShowShardingKeyGenerateAlgorithmImplementationsStatement.java
b/parser/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/statement/ral/queryable/ShowKeyGenerateAlgorithmImplementationsStatement.java
similarity index 79%
copy from
features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/statement/ShowShardingKeyGenerateAlgorithmImplementationsStatement.java
copy to
parser/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/statement/ral/queryable/ShowKeyGenerateAlgorithmImplementationsStatement.java
index 8176594028d..10b9d648f5a 100644
---
a/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/statement/ShowShardingKeyGenerateAlgorithmImplementationsStatement.java
+++
b/parser/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/statement/ral/queryable/ShowKeyGenerateAlgorithmImplementationsStatement.java
@@ -15,12 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.distsql.statement;
+package org.apache.shardingsphere.distsql.statement.ral.queryable;
import org.apache.shardingsphere.distsql.statement.ral.QueryableRALStatement;
/**
- * Show sharding key generate algorithm implementations statement.
+ * Show key generate algorithm implementations statement.
*/
-public final class ShowShardingKeyGenerateAlgorithmImplementationsStatement
extends QueryableRALStatement {
+public final class ShowKeyGenerateAlgorithmImplementationsStatement extends
QueryableRALStatement {
}
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingKeyGenerateAlgorithmImplementationsExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowKeyGenerateAlgorithmImplementationsExecutor.java
similarity index 74%
rename from
features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingKeyGenerateAlgorithmImplementationsExecutor.java
rename to
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowKeyGenerateAlgorithmImplementationsExecutor.java
index eb8dc842b45..d5bc6cc888f 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingKeyGenerateAlgorithmImplementationsExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowKeyGenerateAlgorithmImplementationsExecutor.java
@@ -15,22 +15,22 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.distsql.handler.query;
+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.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
-import
org.apache.shardingsphere.sharding.distsql.statement.ShowShardingKeyGenerateAlgorithmImplementationsStatement;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedList;
/**
- * Show sharding key generate algorithm implementations executor.
+ * Show key generate algorithm implementations executor.
*/
-public final class ShowShardingKeyGenerateAlgorithmImplementationsExecutor
implements
QueryableRALExecutor<ShowShardingKeyGenerateAlgorithmImplementationsStatement> {
+public final class ShowKeyGenerateAlgorithmImplementationsExecutor implements
QueryableRALExecutor<ShowKeyGenerateAlgorithmImplementationsStatement> {
@Override
public Collection<String> getColumnNames() {
@@ -38,7 +38,7 @@ public final class
ShowShardingKeyGenerateAlgorithmImplementationsExecutor imple
}
@Override
- public Collection<LocalDataQueryResultRow> getRows(final
ShowShardingKeyGenerateAlgorithmImplementationsStatement sqlStatement) {
+ public Collection<LocalDataQueryResultRow> getRows(final
ShowKeyGenerateAlgorithmImplementationsStatement sqlStatement) {
Collection<LocalDataQueryResultRow> result = new LinkedList<>();
Collection<KeyGenerateAlgorithm> keyGenerateAlgorithms =
ShardingSphereServiceLoader.getServiceInstances(KeyGenerateAlgorithm.class);
for (KeyGenerateAlgorithm each : keyGenerateAlgorithms) {
@@ -48,7 +48,7 @@ public final class
ShowShardingKeyGenerateAlgorithmImplementationsExecutor imple
}
@Override
- public Class<ShowShardingKeyGenerateAlgorithmImplementationsStatement>
getType() {
- return ShowShardingKeyGenerateAlgorithmImplementationsStatement.class;
+ public Class<ShowKeyGenerateAlgorithmImplementationsStatement> getType() {
+ return ShowKeyGenerateAlgorithmImplementationsStatement.class;
}
}
diff --git
a/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor
b/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor
index 97d4f5329cc..0a2c431c9b0 100644
---
a/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor
+++
b/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor
@@ -28,3 +28,4 @@
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowStatus
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowTableMetaDataExecutor
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowMigrationRuleExecutor
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowServiceProviderImplementationsExecutor
+org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowKeyGenerateAlgorithmImplementationsExecutor
diff --git
a/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/statement/ShowShardingKeyGenerateAlgorithmImplementationsStatement.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/fixture/DistSQLKeyGenerateAlgorithmImplementationsFixture.java
similarity index 50%
rename from
features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/statement/ShowShardingKeyGenerateAlgorithmImplementationsStatement.java
rename to
proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/fixture/DistSQLKeyGenerateAlgorithmImplementationsFixture.java
index 8176594028d..40f1529efc2 100644
---
a/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/statement/ShowShardingKeyGenerateAlgorithmImplementationsStatement.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/fixture/DistSQLKeyGenerateAlgorithmImplementationsFixture.java
@@ -15,12 +15,25 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.distsql.statement;
+package org.apache.shardingsphere.proxy.backend.handler.distsql.fixture;
-import org.apache.shardingsphere.distsql.statement.ral.QueryableRALStatement;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.context.KeyGenerateContext;
-/**
- * Show sharding key generate algorithm implementations statement.
- */
-public final class ShowShardingKeyGenerateAlgorithmImplementationsStatement
extends QueryableRALStatement {
+import java.util.Collection;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+public final class DistSQLKeyGenerateAlgorithmImplementationsFixture
implements KeyGenerateAlgorithm {
+
+ @Override
+ public Collection<Comparable<?>> generateKeys(final KeyGenerateContext
keyGenerateContext, final int keyGenerateCount) {
+ return IntStream.range(0, keyGenerateCount).mapToObj(each ->
0L).collect(Collectors.toList());
+
+ }
+
+ @Override
+ public String getType() {
+ return "DISTSQL.IMPLEMENTATIONS.FIXTURE";
+ }
}
diff --git
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShowShardingKeyGenerateAlgorithmImplementationsExecutorTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowKeyGenerateAlgorithmImplementationsExecutorTest.java
similarity index 64%
rename from
features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShowShardingKeyGenerateAlgorithmImplementationsExecutorTest.java
rename to
proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowKeyGenerateAlgorithmImplementationsExecutorTest.java
index b5eaa7b5dc6..f8a6e87ea36 100644
---
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShowShardingKeyGenerateAlgorithmImplementationsExecutorTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowKeyGenerateAlgorithmImplementationsExecutorTest.java
@@ -15,14 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.distsql.query;
+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.sharding.distsql.handler.query.ShowShardingAlgorithmImplementationsExecutor;
-import
org.apache.shardingsphere.sharding.distsql.handler.query.ShowShardingKeyGenerateAlgorithmImplementationsExecutor;
-import
org.apache.shardingsphere.sharding.distsql.statement.ShowShardingAlgorithmImplementationsStatement;
-import
org.apache.shardingsphere.sharding.distsql.statement.ShowShardingKeyGenerateAlgorithmImplementationsStatement;
import org.junit.jupiter.api.Test;
import java.util.Collection;
@@ -33,23 +30,23 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.mockito.Mockito.mock;
-class ShowShardingKeyGenerateAlgorithmImplementationsExecutorTest {
+class ShowKeyGenerateAlgorithmImplementationsExecutorTest {
@Test
void assertGetRowData() {
-
QueryableRALExecutor<ShowShardingKeyGenerateAlgorithmImplementationsStatement>
executor = new ShowShardingKeyGenerateAlgorithmImplementationsExecutor();
- Collection<LocalDataQueryResultRow> actual =
executor.getRows(mock(ShowShardingKeyGenerateAlgorithmImplementationsStatement.class));
+ QueryableRALExecutor<ShowKeyGenerateAlgorithmImplementationsStatement>
executor = new ShowKeyGenerateAlgorithmImplementationsExecutor();
+ Collection<LocalDataQueryResultRow> actual =
executor.getRows(mock(ShowKeyGenerateAlgorithmImplementationsStatement.class));
assertFalse(actual.isEmpty());
Iterator<LocalDataQueryResultRow> iterator = actual.iterator();
LocalDataQueryResultRow row = iterator.next();
- assertThat(row.getCell(1), is("DistSQLKeyGenerateAlgorithmFixture"));
- assertThat(row.getCell(2), is("DISTSQL.FIXTURE"));
- assertThat(row.getCell(3),
is("org.apache.shardingsphere.sharding.distsql.fixture.keygen.DistSQLKeyGenerateAlgorithmFixture"));
+ assertThat(row.getCell(1),
is("DistSQLKeyGenerateAlgorithmImplementationsFixture"));
+ assertThat(row.getCell(2), is("DISTSQL.IMPLEMENTATIONS.FIXTURE"));
+ assertThat(row.getCell(3),
is("org.apache.shardingsphere.proxy.backend.handler.distsql.fixture.DistSQLKeyGenerateAlgorithmImplementationsFixture"));
}
@Test
void assertGetColumnNames() {
- QueryableRALExecutor<ShowShardingAlgorithmImplementationsStatement>
executor = new ShowShardingAlgorithmImplementationsExecutor();
+ QueryableRALExecutor<ShowKeyGenerateAlgorithmImplementationsStatement>
executor = new ShowKeyGenerateAlgorithmImplementationsExecutor();
Collection<String> columns = executor.getColumnNames();
assertThat(columns.size(), is(3));
Iterator<String> iterator = columns.iterator();
diff --git
a/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor
b/proxy/backend/core/src/test/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
similarity index 78%
copy from
features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor
copy to
proxy/backend/core/src/test/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
index 63593d3b8b1..74db2039b5d 100644
---
a/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor
+++
b/proxy/backend/core/src/test/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
@@ -15,5 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.sharding.distsql.handler.query.ShowShardingAlgorithmImplementationsExecutor
-org.apache.shardingsphere.sharding.distsql.handler.query.ShowShardingKeyGenerateAlgorithmImplementationsExecutor
+org.apache.shardingsphere.proxy.backend.handler.distsql.fixture.DistSQLKeyGenerateAlgorithmImplementationsFixture