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 f75ea734017 Refactor SHOW SHARDING ALGORITHM IMPLEMENTATIONS (#30051)
f75ea734017 is described below

commit f75ea7340170677578086cb6fce49760f4eefa0f
Author: yx9o <[email protected]>
AuthorDate: Wed Feb 7 19:07:24 2024 +0800

    Refactor SHOW SHARDING ALGORITHM IMPLEMENTATIONS (#30051)
---
 .../show-sharding-algorithm-implementations.cn.md  | 40 +++++++++++-----------
 .../show-sharding-algorithm-implementations.en.md  | 38 ++++++++++----------
 ...gAlgorithmImplementationsResultRowBuilder.java} |  8 ++---
 ...rql.spi.ShowSPIImplementationsResultRowBuilder} |  2 +-
 ...orithmImplementationsResultRowBuilderTest.java} |  6 ++--
 .../core/ShardingDistSQLStatementVisitor.java      |  2 +-
 .../{ => spi}/ShowSPIImplementationsExecutor.java  |  4 +--
 .../ShowSPIImplementationsResultRowBuilder.java}   |  6 ++--
 ...stsql.handler.engine.query.DistSQLQueryExecutor |  2 +-
 9 files changed, 54 insertions(+), 54 deletions(-)

diff --git 
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/show-implementation/sharding/show-sharding-algorithm-implementations.cn.md
 
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/show-implementation/sharding/show-sharding-algorithm-implementations.cn.md
index 6f8a70feefe..36ad297df6e 100644
--- 
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/show-implementation/sharding/show-sharding-algorithm-implementations.cn.md
+++ 
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/show-implementation/sharding/show-sharding-algorithm-implementations.cn.md
@@ -23,11 +23,11 @@ showShardingAlgorithmImplementations ::=
 
 ### 返回值说明
 
-| 列    | 说明      |
-|------|---------|
-| name | 实现类名称   |
-| type | 类型      |
-| class_path | 实现类完整路径 |
+| 列            | 说明     |
+|--------------|--------|
+| type         | 类型     |
+| type_aliases | 类型别名   |
+| description  | 描述     |
 
 ### 示例
 
@@ -39,20 +39,20 @@ SHOW SHARDING ALGORITHM IMPLEMENTATIONS
 
 ```sql
 SHOW SHARDING ALGORITHM IMPLEMENTATIONS;
-+-------------------------------------+----------------+-------------------------------------------------------------------------------------------------+
-| name                                | type           | class_path            
                                                                          |
-+-------------------------------------+----------------+-------------------------------------------------------------------------------------------------+
-| ModShardingAlgorithm                | MOD            | 
org.apache.shardingsphere.sharding.algorithm.sharding.mod.ModShardingAlgorithm  
                |
-| HashModShardingAlgorithm            | HASH_MOD       | 
org.apache.shardingsphere.sharding.algorithm.sharding.mod.HashModShardingAlgorithm
              |
-| VolumeBasedRangeShardingAlgorithm   | VOLUME_RANGE   | 
org.apache.shardingsphere.sharding.algorithm.sharding.range.VolumeBasedRangeShardingAlgorithm
   |
-| BoundaryBasedRangeShardingAlgorithm | BOUNDARY_RANGE | 
org.apache.shardingsphere.sharding.algorithm.sharding.range.BoundaryBasedRangeShardingAlgorithm
 |
-| AutoIntervalShardingAlgorithm       | AUTO_INTERVAL  | 
org.apache.shardingsphere.sharding.algorithm.sharding.datetime.AutoIntervalShardingAlgorithm
    |
-| IntervalShardingAlgorithm           | INTERVAL       | 
org.apache.shardingsphere.sharding.algorithm.sharding.datetime.IntervalShardingAlgorithm
        |
-| ClassBasedShardingAlgorithm         | CLASS_BASED    | 
org.apache.shardingsphere.sharding.algorithm.sharding.classbased.ClassBasedShardingAlgorithm
    |
-| InlineShardingAlgorithm             | INLINE         | 
org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm
            |
-| ComplexInlineShardingAlgorithm      | COMPLEX_INLINE | 
org.apache.shardingsphere.sharding.algorithm.sharding.inline.ComplexInlineShardingAlgorithm
     |
-| HintInlineShardingAlgorithm         | HINT_INLINE    | 
org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm
          |
-+-------------------------------------+----------------+-------------------------------------------------------------------------------------------------+
++----------------+--------------+-------------+
+| type           | type_aliases | description |
++----------------+--------------+-------------+
+| MOD            |              |             |
+| HASH_MOD       |              |             |
+| VOLUME_RANGE   |              |             |
+| BOUNDARY_RANGE |              |             |
+| AUTO_INTERVAL  |              |             |
+| INTERVAL       |              |             |
+| CLASS_BASED    |              |             |
+| INLINE         |              |             |
+| COMPLEX_INLINE |              |             |
+| HINT_INLINE    |              |             |
++----------------+--------------+-------------+
 10 rows in set (0.27 sec)
 ```
 
@@ -62,4 +62,4 @@ SHOW SHARDING ALGORITHM IMPLEMENTATIONS;
 
 ### 相关链接
 
-- [保留字](/cn/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word/)
\ No newline at end of file
+- [保留字](/cn/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word/)
diff --git 
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/show-implementation/sharding/show-sharding-algorithm-implementations.en.md
 
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/show-implementation/sharding/show-sharding-algorithm-implementations.en.md
index 53cf5986df3..8cef86a1328 100644
--- 
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/show-implementation/sharding/show-sharding-algorithm-implementations.en.md
+++ 
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/show-implementation/sharding/show-sharding-algorithm-implementations.en.md
@@ -23,11 +23,11 @@ showShardingAlgorithmImplementations ::=
 
 ### Return Value Description
 
-| Columns     | Description                           |
-|-------------|---------------------------------------|
-| name        | class name of the implementation      |
-| type        | type of the implementation            |
-| class_path  | full class name of the implementation |
+| Columns      | Description  |
+|--------------|--------------|
+| type         | type         |
+| type_aliases | type aliases |
+| description  | description  |
 
 ### Example
 
@@ -39,20 +39,20 @@ SHOW SHARDING ALGORITHM IMPLEMENTATIONS
 
 ```sql
 SHOW SHARDING ALGORITHM IMPLEMENTATIONS;
-+-------------------------------------+----------------+-------------------------------------------------------------------------------------------------+
-| name                                | type           | class_path            
                                                                          |
-+-------------------------------------+----------------+-------------------------------------------------------------------------------------------------+
-| ModShardingAlgorithm                | MOD            | 
org.apache.shardingsphere.sharding.algorithm.sharding.mod.ModShardingAlgorithm  
                |
-| HashModShardingAlgorithm            | HASH_MOD       | 
org.apache.shardingsphere.sharding.algorithm.sharding.mod.HashModShardingAlgorithm
              |
-| VolumeBasedRangeShardingAlgorithm   | VOLUME_RANGE   | 
org.apache.shardingsphere.sharding.algorithm.sharding.range.VolumeBasedRangeShardingAlgorithm
   |
-| BoundaryBasedRangeShardingAlgorithm | BOUNDARY_RANGE | 
org.apache.shardingsphere.sharding.algorithm.sharding.range.BoundaryBasedRangeShardingAlgorithm
 |
-| AutoIntervalShardingAlgorithm       | AUTO_INTERVAL  | 
org.apache.shardingsphere.sharding.algorithm.sharding.datetime.AutoIntervalShardingAlgorithm
    |
-| IntervalShardingAlgorithm           | INTERVAL       | 
org.apache.shardingsphere.sharding.algorithm.sharding.datetime.IntervalShardingAlgorithm
        |
-| ClassBasedShardingAlgorithm         | CLASS_BASED    | 
org.apache.shardingsphere.sharding.algorithm.sharding.classbased.ClassBasedShardingAlgorithm
    |
-| InlineShardingAlgorithm             | INLINE         | 
org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm
            |
-| ComplexInlineShardingAlgorithm      | COMPLEX_INLINE | 
org.apache.shardingsphere.sharding.algorithm.sharding.inline.ComplexInlineShardingAlgorithm
     |
-| HintInlineShardingAlgorithm         | HINT_INLINE    | 
org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm
          |
-+-------------------------------------+----------------+-------------------------------------------------------------------------------------------------+
++----------------+--------------+-------------+
+| type           | type_aliases | description |
++----------------+--------------+-------------+
+| MOD            |              |             |
+| HASH_MOD       |              |             |
+| VOLUME_RANGE   |              |             |
+| BOUNDARY_RANGE |              |             |
+| AUTO_INTERVAL  |              |             |
+| INTERVAL       |              |             |
+| CLASS_BASED    |              |             |
+| INLINE         |              |             |
+| COMPLEX_INLINE |              |             |
+| HINT_INLINE    |              |             |
++----------------+--------------+-------------+
 10 rows in set (0.27 sec)
 ```
 
diff --git 
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingSPIImplementationsResultRowBuilder.java
 
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingAlgorithmImplementationsResultRowBuilder.java
similarity index 86%
rename from 
features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingSPIImplementationsResultRowBuilder.java
rename to 
features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingAlgorithmImplementationsResultRowBuilder.java
index 4b87d3673b4..ce17aa4e2f5 100644
--- 
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingSPIImplementationsResultRowBuilder.java
+++ 
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingAlgorithmImplementationsResultRowBuilder.java
@@ -18,16 +18,16 @@
 package org.apache.shardingsphere.sharding.distsql.handler.query;
 
 import 
org.apache.shardingsphere.distsql.handler.engine.query.ral.algorithm.AlgorithmMetaDataQueryResultRows;
-import 
org.apache.shardingsphere.distsql.handler.engine.query.rql.ShowSPIImplementationsBuilder;
+import 
org.apache.shardingsphere.distsql.handler.engine.query.rql.spi.ShowSPIImplementationsResultRowBuilder;
 import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
 import org.apache.shardingsphere.sharding.spi.ShardingAlgorithm;
 
 import java.util.Collection;
 
 /**
- * Sharding SPI implementations result row builder.
+ * Show sharding algorithm implementations result row builder.
  */
-public final class ShardingSPIImplementationsResultRowBuilder implements 
ShowSPIImplementationsBuilder {
+public final class ShowShardingAlgorithmImplementationsResultRowBuilder 
implements ShowSPIImplementationsResultRowBuilder {
     
     private final AlgorithmMetaDataQueryResultRows 
algorithmMetaDataQueryResultRows = new 
AlgorithmMetaDataQueryResultRows(ShardingAlgorithm.class);
     
@@ -43,6 +43,6 @@ public final class ShardingSPIImplementationsResultRowBuilder 
implements ShowSPI
     
     @Override
     public String getType() {
-        return "SHARDING";
+        return "SHARDING_ALGORITHM";
     }
 }
diff --git 
a/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.rql.ShowSPIImplementationsBuilder
 
b/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.rql.spi.ShowSPIImplementationsResultRowBuilder
similarity index 87%
rename from 
features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.rql.ShowSPIImplementationsBuilder
rename to 
features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.rql.spi.ShowSPIImplementationsResultRowBuilder
index 65cdc911905..2e85233522c 100644
--- 
a/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.rql.ShowSPIImplementationsBuilder
+++ 
b/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.rql.spi.ShowSPIImplementationsResultRowBuilder
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.sharding.distsql.handler.query.ShardingSPIImplementationsResultRowBuilder
+org.apache.shardingsphere.sharding.distsql.handler.query.ShowShardingAlgorithmImplementationsResultRowBuilder
diff --git 
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShardingSPIImplementationsResultRowBuilderTest.java
 
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShowShardingAlgorithmImplementationsResultRowBuilderTest.java
similarity index 94%
rename from 
features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShardingSPIImplementationsResultRowBuilderTest.java
rename to 
features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShowShardingAlgorithmImplementationsResultRowBuilderTest.java
index f556c4de9fa..1b3c2e2b902 100644
--- 
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShardingSPIImplementationsResultRowBuilderTest.java
+++ 
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShowShardingAlgorithmImplementationsResultRowBuilderTest.java
@@ -18,7 +18,7 @@
 package org.apache.shardingsphere.sharding.distsql.query;
 
 import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
-import 
org.apache.shardingsphere.sharding.distsql.handler.query.ShardingSPIImplementationsResultRowBuilder;
+import 
org.apache.shardingsphere.sharding.distsql.handler.query.ShowShardingAlgorithmImplementationsResultRowBuilder;
 import org.junit.jupiter.api.Test;
 
 import java.util.Collection;
@@ -27,11 +27,11 @@ import java.util.Iterator;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
 
-class ShardingSPIImplementationsResultRowBuilderTest {
+class ShowShardingAlgorithmImplementationsResultRowBuilderTest {
     
     @Test
     void assertGetRowData() {
-        ShardingSPIImplementationsResultRowBuilder rowBuilder = new 
ShardingSPIImplementationsResultRowBuilder();
+        ShowShardingAlgorithmImplementationsResultRowBuilder rowBuilder = new 
ShowShardingAlgorithmImplementationsResultRowBuilder();
         Collection<LocalDataQueryResultRow> actual = rowBuilder.generateRows();
         assertThat(actual.size(), is(15));
         Iterator<LocalDataQueryResultRow> iterator = actual.iterator();
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 8ec9854c2a6..ff3d13ea8d5 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
@@ -405,6 +405,6 @@ public final class ShardingDistSQLStatementVisitor extends 
ShardingDistSQLStatem
     
     @Override
     public ASTNode visitShowShardingAlgorithmImplementations(final 
ShowShardingAlgorithmImplementationsContext ctx) {
-        return new ShowSPIImplementationsStatement("SHARDING");
+        return new ShowSPIImplementationsStatement("SHARDING_ALGORITHM");
     }
 }
diff --git 
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/query/rql/ShowSPIImplementationsExecutor.java
 
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/query/rql/spi/ShowSPIImplementationsExecutor.java
similarity index 92%
rename from 
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/query/rql/ShowSPIImplementationsExecutor.java
rename to 
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/query/rql/spi/ShowSPIImplementationsExecutor.java
index b01f1a70b8e..4a2c7afcca9 100644
--- 
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/query/rql/ShowSPIImplementationsExecutor.java
+++ 
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/query/rql/spi/ShowSPIImplementationsExecutor.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.distsql.handler.engine.query.rql;
+package org.apache.shardingsphere.distsql.handler.engine.query.rql.spi;
 
 import lombok.Setter;
 import 
org.apache.shardingsphere.distsql.handler.engine.query.DistSQLQueryExecutor;
@@ -42,7 +42,7 @@ public final class ShowSPIImplementationsExecutor implements 
DistSQLQueryExecuto
     
     @Override
     public Collection<LocalDataQueryResultRow> getRows(final 
ShowSPIImplementationsStatement sqlStatement, final ContextManager 
contextManager) {
-        Optional<ShowSPIImplementationsBuilder> rowBuilder = 
TypedSPILoader.findService(ShowSPIImplementationsBuilder.class, 
sqlStatement.getType());
+        Optional<ShowSPIImplementationsResultRowBuilder> rowBuilder = 
TypedSPILoader.findService(ShowSPIImplementationsResultRowBuilder.class, 
sqlStatement.getType());
         if (!rowBuilder.isPresent()) {
             return Collections.emptyList();
         }
diff --git 
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/query/rql/ShowSPIImplementationsBuilder.java
 
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/query/rql/spi/ShowSPIImplementationsResultRowBuilder.java
similarity index 91%
rename from 
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/query/rql/ShowSPIImplementationsBuilder.java
rename to 
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/query/rql/spi/ShowSPIImplementationsResultRowBuilder.java
index 12df29bb741..6d88c02a1f3 100644
--- 
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/query/rql/ShowSPIImplementationsBuilder.java
+++ 
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/query/rql/spi/ShowSPIImplementationsResultRowBuilder.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.distsql.handler.engine.query.rql;
+package org.apache.shardingsphere.distsql.handler.engine.query.rql.spi;
 
 import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
 import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI;
@@ -24,10 +24,10 @@ import 
org.apache.shardingsphere.infra.spi.type.typed.TypedSPI;
 import java.util.Collection;
 
 /**
- * Show SPI implementations builder.
+ * Show SPI implementations result row builder.
  */
 @SingletonSPI
-public interface ShowSPIImplementationsBuilder extends TypedSPI {
+public interface ShowSPIImplementationsResultRowBuilder extends TypedSPI {
     
     /**
      * Generate rows.
diff --git 
a/infra/distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.DistSQLQueryExecutor
 
b/infra/distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.DistSQLQueryExecutor
index ff8b4cb5ad2..287970a4e48 100644
--- 
a/infra/distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.DistSQLQueryExecutor
+++ 
b/infra/distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.DistSQLQueryExecutor
@@ -16,4 +16,4 @@
 #
 
 org.apache.shardingsphere.distsql.handler.executor.rql.rule.RuleCountExecutor
-org.apache.shardingsphere.distsql.handler.engine.query.rql.ShowSPIImplementationsExecutor
+org.apache.shardingsphere.distsql.handler.engine.query.rql.spi.ShowSPIImplementationsExecutor

Reply via email to