This is an automated email from the ASF dual-hosted git repository.

azexin 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 bc575fd8c78 Add "type_aliases" column in "show migration check 
algorithms" DistSQL result (#28453)
bc575fd8c78 is described below

commit bc575fd8c78421a7aa4f48c8876506e0239bd581
Author: Hongsheng Zhong <[email protected]>
AuthorDate: Mon Sep 18 09:55:13 2023 +0800

    Add "type_aliases" column in "show migration check algorithms" DistSQL 
result (#28453)
---
 .../data/pipeline/common/pojo/DataConsistencyCheckAlgorithmInfo.java  | 2 ++
 .../core/job/service/impl/AbstractInventoryIncrementalJobAPIImpl.java | 4 +++-
 .../distsql/handler/query/ShowMigrationCheckAlgorithmsExecutor.java   | 4 ++--
 .../handler/query/ShowMigrationCheckAlgorithmsExecutorTest.java       | 3 ++-
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/common/pojo/DataConsistencyCheckAlgorithmInfo.java
 
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/common/pojo/DataConsistencyCheckAlgorithmInfo.java
index cf93fe1df21..4517de99e72 100644
--- 
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/common/pojo/DataConsistencyCheckAlgorithmInfo.java
+++ 
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/common/pojo/DataConsistencyCheckAlgorithmInfo.java
@@ -32,6 +32,8 @@ public final class DataConsistencyCheckAlgorithmInfo {
     
     private final String type;
     
+    private final String typeAliases;
+    
     private final Collection<DatabaseType> supportedDatabaseTypes;
     
     private final String description;
diff --git 
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/service/impl/AbstractInventoryIncrementalJobAPIImpl.java
 
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/service/impl/AbstractInventoryIncrementalJobAPIImpl.java
index 560456be746..ecf481e03cb 100644
--- 
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/service/impl/AbstractInventoryIncrementalJobAPIImpl.java
+++ 
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/service/impl/AbstractInventoryIncrementalJobAPIImpl.java
@@ -61,6 +61,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Optional;
+import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
 /**
@@ -203,7 +204,8 @@ public abstract class 
AbstractInventoryIncrementalJobAPIImpl extends AbstractPip
         Collection<DataConsistencyCheckAlgorithmInfo> result = new 
LinkedList<>();
         for (TableDataConsistencyChecker each : 
ShardingSphereServiceLoader.getServiceInstances(TableDataConsistencyChecker.class))
 {
             SPIDescription description = 
each.getClass().getAnnotation(SPIDescription.class);
-            result.add(new DataConsistencyCheckAlgorithmInfo(each.getType(), 
getSupportedDatabaseTypes(each.getSupportedDatabaseTypes()), null == 
description ? "" : description.value()));
+            String typeAliases = 
each.getTypeAliases().stream().map(Object::toString).collect(Collectors.joining(","));
+            result.add(new DataConsistencyCheckAlgorithmInfo(each.getType(), 
typeAliases, getSupportedDatabaseTypes(each.getSupportedDatabaseTypes()), null 
== description ? "" : description.value()));
         }
         return result;
     }
diff --git 
a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationCheckAlgorithmsExecutor.java
 
b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationCheckAlgorithmsExecutor.java
index 5828efe9381..6b99ab54353 100644
--- 
a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationCheckAlgorithmsExecutor.java
+++ 
b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationCheckAlgorithmsExecutor.java
@@ -38,14 +38,14 @@ public final class ShowMigrationCheckAlgorithmsExecutor 
implements QueryableRALE
     public Collection<LocalDataQueryResultRow> getRows(final 
ShowMigrationCheckAlgorithmsStatement sqlStatement) {
         InventoryIncrementalJobAPI jobAPI = (InventoryIncrementalJobAPI) 
TypedSPILoader.getService(PipelineJobAPI.class, "MIGRATION");
         return jobAPI.listDataConsistencyCheckAlgorithms().stream().map(
-                each -> new LocalDataQueryResultRow(each.getType(),
+                each -> new LocalDataQueryResultRow(each.getType(), 
each.getTypeAliases(),
                         
each.getSupportedDatabaseTypes().stream().map(DatabaseType::getType).collect(Collectors.joining(",")),
 each.getDescription()))
                 .collect(Collectors.toList());
     }
     
     @Override
     public Collection<String> getColumnNames() {
-        return Arrays.asList("type", "supported_database_types", 
"description");
+        return Arrays.asList("type", "type_aliases", 
"supported_database_types", "description");
     }
     
     @Override
diff --git 
a/kernel/data-pipeline/distsql/handler/src/test/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationCheckAlgorithmsExecutorTest.java
 
b/kernel/data-pipeline/distsql/handler/src/test/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationCheckAlgorithmsExecutorTest.java
index c458446260a..2cca2b07486 100644
--- 
a/kernel/data-pipeline/distsql/handler/src/test/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationCheckAlgorithmsExecutorTest.java
+++ 
b/kernel/data-pipeline/distsql/handler/src/test/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationCheckAlgorithmsExecutorTest.java
@@ -31,9 +31,10 @@ class ShowMigrationCheckAlgorithmsExecutorTest {
     void assertGetColumnNames() {
         ShowMigrationCheckAlgorithmsExecutor executor = new 
ShowMigrationCheckAlgorithmsExecutor();
         Collection<String> columns = executor.getColumnNames();
-        assertThat(columns.size(), is(3));
+        assertThat(columns.size(), is(4));
         Iterator<String> iterator = columns.iterator();
         assertThat(iterator.next(), is("type"));
+        assertThat(iterator.next(), is("type_aliases"));
         assertThat(iterator.next(), is("supported_database_types"));
         assertThat(iterator.next(), is("description"));
     }

Reply via email to