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

zhangliang 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 e49916a7073 Move package of TableStatisticsCollector (#34441)
e49916a7073 is described below

commit e49916a7073d8b3ca5870d785ef7a501b47ae425
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Jan 23 18:08:55 2025 +0800

    Move package of TableStatisticsCollector (#34441)
---
 .../data/ShardingTableStatisticsCollector.java        |  2 +-
 ...atistics.collector.table.TableStatisticsCollector} |  0
 .../data/ShardingTableStatisticsCollectorTest.java    |  2 +-
 .../MySQLShardingTableStatisticsCollectorTest.java    |  2 +-
 ...OpenGaussShardingTableStatisticsCollectorTest.java |  2 +-
 ...ostgreSQLShardingTableStatisticsCollectorTest.java |  2 +-
 .../{ => row}/RowStatisticsCollectorUtils.java        | 19 +++++++------------
 .../{ => table}/TableStatisticsCollector.java         |  2 +-
 .../type}/PgClassTableStatisticsCollector.java        |  8 ++++----
 .../type}/PgNamespaceTableStatisticsCollector.java    |  8 ++++----
 ...atistics.collector.table.TableStatisticsCollector} |  4 ++--
 .../ShardingSphereStatisticsRefreshEngine.java        |  2 +-
 .../mode/fixture/TableStatisticsCollectorFixture.java |  2 +-
 ...atistics.collector.table.TableStatisticsCollector} |  0
 14 files changed, 25 insertions(+), 30 deletions(-)

diff --git 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingTableStatisticsCollector.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingTableStatisticsCollector.java
index dd74c2b5d5a..7654d7c446b 100644
--- 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingTableStatisticsCollector.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingTableStatisticsCollector.java
@@ -29,7 +29,7 @@ import 
org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUn
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
 import org.apache.shardingsphere.infra.metadata.statistics.RowStatistics;
 import org.apache.shardingsphere.infra.metadata.statistics.TableStatistics;
-import 
org.apache.shardingsphere.infra.metadata.statistics.collector.TableStatisticsCollector;
+import 
org.apache.shardingsphere.infra.metadata.statistics.collector.table.TableStatisticsCollector;
 import 
org.apache.shardingsphere.infra.rule.attribute.datasource.aggregate.AggregatedDataSourceRuleAttribute;
 import 
org.apache.shardingsphere.sharding.metadata.data.dialect.DialectShardingStatisticsTableCollector;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
diff --git 
a/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.statistics.collector.TableStatisticsCollector
 
b/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.statistics.collector.table.TableStatisticsCollector
similarity index 100%
rename from 
features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.statistics.collector.TableStatisticsCollector
rename to 
features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.statistics.collector.table.TableStatisticsCollector
diff --git 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/ShardingTableStatisticsCollectorTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/ShardingTableStatisticsCollectorTest.java
index aa0339176ad..28152b3374f 100644
--- 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/ShardingTableStatisticsCollectorTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/ShardingTableStatisticsCollectorTest.java
@@ -27,7 +27,7 @@ import 
org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
 import org.apache.shardingsphere.infra.metadata.statistics.RowStatistics;
 import org.apache.shardingsphere.infra.metadata.statistics.TableStatistics;
-import 
org.apache.shardingsphere.infra.metadata.statistics.collector.TableStatisticsCollector;
+import 
org.apache.shardingsphere.infra.metadata.statistics.collector.table.TableStatisticsCollector;
 import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import org.apache.shardingsphere.sharding.rule.ShardingTable;
diff --git 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/MySQLShardingTableStatisticsCollectorTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/MySQLShardingTableStatisticsCollectorTest.java
index b3241c946df..339d8134c18 100644
--- 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/MySQLShardingTableStatisticsCollectorTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/MySQLShardingTableStatisticsCollectorTest.java
@@ -27,7 +27,7 @@ import 
org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
 import org.apache.shardingsphere.infra.metadata.statistics.RowStatistics;
 import org.apache.shardingsphere.infra.metadata.statistics.TableStatistics;
-import 
org.apache.shardingsphere.infra.metadata.statistics.collector.TableStatisticsCollector;
+import 
org.apache.shardingsphere.infra.metadata.statistics.collector.table.TableStatisticsCollector;
 import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import org.apache.shardingsphere.sharding.rule.ShardingTable;
diff --git 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/OpenGaussShardingTableStatisticsCollectorTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/OpenGaussShardingTableStatisticsCollectorTest.java
index 034dc1d78a4..2d0d8ce4f0d 100644
--- 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/OpenGaussShardingTableStatisticsCollectorTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/OpenGaussShardingTableStatisticsCollectorTest.java
@@ -27,7 +27,7 @@ import 
org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
 import org.apache.shardingsphere.infra.metadata.statistics.RowStatistics;
 import org.apache.shardingsphere.infra.metadata.statistics.TableStatistics;
-import 
org.apache.shardingsphere.infra.metadata.statistics.collector.TableStatisticsCollector;
+import 
org.apache.shardingsphere.infra.metadata.statistics.collector.table.TableStatisticsCollector;
 import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import org.apache.shardingsphere.sharding.rule.ShardingTable;
diff --git 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/PostgreSQLShardingTableStatisticsCollectorTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/PostgreSQLShardingTableStatisticsCollectorTest.java
index ffcc2805b6e..3a28d7a076d 100644
--- 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/PostgreSQLShardingTableStatisticsCollectorTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/PostgreSQLShardingTableStatisticsCollectorTest.java
@@ -27,7 +27,7 @@ import 
org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
 import org.apache.shardingsphere.infra.metadata.statistics.RowStatistics;
 import org.apache.shardingsphere.infra.metadata.statistics.TableStatistics;
-import 
org.apache.shardingsphere.infra.metadata.statistics.collector.TableStatisticsCollector;
+import 
org.apache.shardingsphere.infra.metadata.statistics.collector.table.TableStatisticsCollector;
 import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import org.apache.shardingsphere.sharding.rule.ShardingTable;
diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/RowStatisticsCollectorUtils.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/row/RowStatisticsCollectorUtils.java
similarity index 76%
rename from 
infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/RowStatisticsCollectorUtils.java
rename to 
infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/row/RowStatisticsCollectorUtils.java
index 7117eb93255..f263f9b9e03 100644
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/RowStatisticsCollectorUtils.java
+++ 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/row/RowStatisticsCollectorUtils.java
@@ -15,17 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.metadata.statistics.collector;
+package org.apache.shardingsphere.infra.metadata.statistics.collector.row;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
-import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
 
 import java.sql.Types;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * Row statistics collector utility class.
@@ -34,18 +33,14 @@ import java.util.Map;
 public final class RowStatisticsCollectorUtils {
     
     /**
-     * Create row value.
+     * Create row values.
      *
      * @param columnValues column values
-     * @param table sharding sphere table
-     * @return objects
+     * @param table table
+     * @return row values
      */
-    public static List<Object> createRowValue(final Map<String, Object> 
columnValues, final ShardingSphereTable table) {
-        List<Object> result = new LinkedList<>();
-        for (ShardingSphereColumn each : table.getAllColumns()) {
-            result.add(columnValues.getOrDefault(each.getName(), 
mockValue(each.getDataType())));
-        }
-        return result;
+    public static List<Object> createRowValues(final Map<String, Object> 
columnValues, final ShardingSphereTable table) {
+        return table.getAllColumns().stream().map(each -> 
columnValues.getOrDefault(each.getName(), 
mockValue(each.getDataType()))).collect(Collectors.toList());
     }
     
     private static Object mockValue(final int dataType) {
diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/TableStatisticsCollector.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/table/TableStatisticsCollector.java
similarity index 99%
rename from 
infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/TableStatisticsCollector.java
rename to 
infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/table/TableStatisticsCollector.java
index 862d49e0f6c..6fc1303502c 100644
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/TableStatisticsCollector.java
+++ 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/table/TableStatisticsCollector.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.metadata.statistics.collector;
+package org.apache.shardingsphere.infra.metadata.statistics.collector.table;
 
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/tables/PgClassTableStatisticsCollector.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/table/type/PgClassTableStatisticsCollector.java
similarity index 95%
rename from 
infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/tables/PgClassTableStatisticsCollector.java
rename to 
infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/table/type/PgClassTableStatisticsCollector.java
index 4e92fd9a513..ddcaa2057b0 100644
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/tables/PgClassTableStatisticsCollector.java
+++ 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/table/type/PgClassTableStatisticsCollector.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.metadata.statistics.collector.tables;
+package 
org.apache.shardingsphere.infra.metadata.statistics.collector.table.type;
 
 import com.cedarsoftware.util.CaseInsensitiveMap;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
@@ -23,8 +23,8 @@ import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSp
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
 import org.apache.shardingsphere.infra.metadata.statistics.RowStatistics;
 import org.apache.shardingsphere.infra.metadata.statistics.TableStatistics;
-import 
org.apache.shardingsphere.infra.metadata.statistics.collector.TableStatisticsCollector;
-import 
org.apache.shardingsphere.infra.metadata.statistics.collector.RowStatisticsCollectorUtils;
+import 
org.apache.shardingsphere.infra.metadata.statistics.collector.table.TableStatisticsCollector;
+import 
org.apache.shardingsphere.infra.metadata.statistics.collector.row.RowStatisticsCollectorUtils;
 
 import java.sql.SQLException;
 import java.util.Collection;
@@ -61,7 +61,7 @@ public final class PgClassTableStatisticsCollector implements 
TableStatisticsCol
             columnValues.put("relnamespace", relNamespace);
             columnValues.put("relname", each.getName());
             columnValues.put("relkind", "r");
-            result.add(new 
RowStatistics(RowStatisticsCollectorUtils.createRowValue(columnValues, table)));
+            result.add(new 
RowStatistics(RowStatisticsCollectorUtils.createRowValues(columnValues, 
table)));
         }
         return result;
     }
diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/tables/PgNamespaceTableStatisticsCollector.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/table/type/PgNamespaceTableStatisticsCollector.java
similarity index 94%
rename from 
infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/tables/PgNamespaceTableStatisticsCollector.java
rename to 
infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/table/type/PgNamespaceTableStatisticsCollector.java
index abf7543a3cc..02e86253e29 100644
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/tables/PgNamespaceTableStatisticsCollector.java
+++ 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/table/type/PgNamespaceTableStatisticsCollector.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.metadata.statistics.collector.tables;
+package 
org.apache.shardingsphere.infra.metadata.statistics.collector.table.type;
 
 import com.cedarsoftware.util.CaseInsensitiveMap;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
@@ -23,8 +23,8 @@ import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSp
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
 import org.apache.shardingsphere.infra.metadata.statistics.RowStatistics;
 import org.apache.shardingsphere.infra.metadata.statistics.TableStatistics;
-import 
org.apache.shardingsphere.infra.metadata.statistics.collector.TableStatisticsCollector;
-import 
org.apache.shardingsphere.infra.metadata.statistics.collector.RowStatisticsCollectorUtils;
+import 
org.apache.shardingsphere.infra.metadata.statistics.collector.table.TableStatisticsCollector;
+import 
org.apache.shardingsphere.infra.metadata.statistics.collector.row.RowStatisticsCollectorUtils;
 
 import java.sql.SQLException;
 import java.util.List;
@@ -56,7 +56,7 @@ public final class PgNamespaceTableStatisticsCollector 
implements TableStatistic
         Map<String, Object> columnValues = new CaseInsensitiveMap<>(2, 1F);
         columnValues.put("oid", oid);
         columnValues.put("nspname", schemaName);
-        return RowStatisticsCollectorUtils.createRowValue(columnValues, table);
+        return RowStatisticsCollectorUtils.createRowValues(columnValues, 
table);
     }
     
     @Override
diff --git 
a/infra/common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.statistics.collector.TableStatisticsCollector
 
b/infra/common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.statistics.collector.table.TableStatisticsCollector
similarity index 91%
rename from 
infra/common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.statistics.collector.TableStatisticsCollector
rename to 
infra/common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.statistics.collector.table.TableStatisticsCollector
index 602a2038048..6a311866ebf 100644
--- 
a/infra/common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.statistics.collector.TableStatisticsCollector
+++ 
b/infra/common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.statistics.collector.table.TableStatisticsCollector
@@ -15,5 +15,5 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.infra.metadata.statistics.collector.tables.PgNamespaceTableStatisticsCollector
-org.apache.shardingsphere.infra.metadata.statistics.collector.tables.PgClassTableStatisticsCollector
+org.apache.shardingsphere.infra.metadata.statistics.collector.table.type.PgNamespaceTableStatisticsCollector
+org.apache.shardingsphere.infra.metadata.statistics.collector.table.type.PgClassTableStatisticsCollector
diff --git 
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/refresher/ShardingSphereStatisticsRefreshEngine.java
 
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/refresher/ShardingSphereStatisticsRefreshEngine.java
index 5503e503d2e..b7a82f57d77 100644
--- 
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/refresher/ShardingSphereStatisticsRefreshEngine.java
+++ 
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/refresher/ShardingSphereStatisticsRefreshEngine.java
@@ -31,7 +31,7 @@ import 
org.apache.shardingsphere.infra.metadata.statistics.RowStatistics;
 import org.apache.shardingsphere.infra.metadata.statistics.SchemaStatistics;
 import 
org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereStatistics;
 import org.apache.shardingsphere.infra.metadata.statistics.TableStatistics;
-import 
org.apache.shardingsphere.infra.metadata.statistics.collector.TableStatisticsCollector;
+import 
org.apache.shardingsphere.infra.metadata.statistics.collector.table.TableStatisticsCollector;
 import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
 import 
org.apache.shardingsphere.infra.yaml.data.swapper.YamlRowStatisticsSwapper;
 import 
org.apache.shardingsphere.mode.metadata.persist.statistics.AlteredDatabaseStatistics;
diff --git 
a/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/TableStatisticsCollectorFixture.java
 
b/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/TableStatisticsCollectorFixture.java
index 7606e956924..fedce3430d2 100644
--- 
a/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/TableStatisticsCollectorFixture.java
+++ 
b/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/TableStatisticsCollectorFixture.java
@@ -21,7 +21,7 @@ import 
org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
 import org.apache.shardingsphere.infra.metadata.statistics.RowStatistics;
 import org.apache.shardingsphere.infra.metadata.statistics.TableStatistics;
-import 
org.apache.shardingsphere.infra.metadata.statistics.collector.TableStatisticsCollector;
+import 
org.apache.shardingsphere.infra.metadata.statistics.collector.table.TableStatisticsCollector;
 
 import java.sql.SQLException;
 import java.util.Arrays;
diff --git 
a/mode/core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.statistics.collector.TableStatisticsCollector
 
b/mode/core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.statistics.collector.table.TableStatisticsCollector
similarity index 100%
rename from 
mode/core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.statistics.collector.TableStatisticsCollector
rename to 
mode/core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.statistics.collector.table.TableStatisticsCollector

Reply via email to