From 0406b05cd72eb8f4a499696373f35d56bc954ffc Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Mon, 2 Dec 2024 19:30:00 +0800 Subject: [PATCH] Refactor ShardingSphereStatisticsCollector (#33884) * Refactor ShardingSphereStatisticsRefreshEngine * Refactor ShardingSphereStatisticsCollector * Refactor ShardingSphereStatisticsCollector --- .../data/ShardingStatisticsTableCollector.java | 11 +++++------ .../data/ShardingStatisticsTableCollectorTest.java | 11 +++++++++-- .../MySQLShardingStatisticsTableCollectorTest.java | 7 ++++++- ...OpenGaussShardingStatisticsTableCollectorTest.java | 11 +++++++++-- ...ostgreSQLShardingStatisticsTableCollectorTest.java | 7 ++++++- .../collector/ShardingSphereStatisticsCollector.java | 11 ++++------- .../collector/tables/PgClassTableCollector.java | 8 +++----- .../collector/tables/PgNamespaceTableCollector.java | 8 +++----- .../ShardingSphereStatisticsRefreshEngine.java | 2 +- .../mode/fixture/StatisticsCollectorFixture.java | 7 ++----- 10 files changed, 48 insertions(+), 35 deletions(-) diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollector.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollector.java index b70c2280f3f03..e0735b75a0c94 100644 --- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollector.java +++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollector.java @@ -22,9 +22,9 @@ import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry; import org.apache.shardingsphere.infra.datanode.DataNode; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; -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.ShardingSphereRowData; import org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereTableData; @@ -49,15 +49,14 @@ public final class ShardingStatisticsTableCollector implements ShardingSphereSta private static final String SHARDING_TABLE_STATISTICS = "sharding_table_statistics"; @Override - public Optional collect(final String databaseName, final ShardingSphereTable table, - final Map databases, final RuleMetaData globalRuleMetaData) throws SQLException { + public Optional collect(final String databaseName, final ShardingSphereTable table, final ShardingSphereMetaData metaData) throws SQLException { ShardingSphereTableData result = new ShardingSphereTableData(SHARDING_TABLE_STATISTICS); - DatabaseType protocolType = databases.values().iterator().next().getProtocolType(); + DatabaseType protocolType = metaData.getAllDatabases().iterator().next().getProtocolType(); DialectDatabaseMetaData dialectDatabaseMetaData = new DatabaseTypeRegistry(protocolType).getDialectDatabaseMetaData(); if (dialectDatabaseMetaData.getDefaultSchema().isPresent()) { - collectFromDatabase(databases.get(databaseName), result); + collectFromDatabase(metaData.getDatabase(databaseName), result); } else { - for (ShardingSphereDatabase each : databases.values()) { + for (ShardingSphereDatabase each : metaData.getAllDatabases()) { collectFromDatabase(each, result); } } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollectorTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollectorTest.java index 9cbb9f3a030b0..16bb6c65e6fd8 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollectorTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollectorTest.java @@ -17,7 +17,9 @@ package org.apache.shardingsphere.sharding.metadata.data; +import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; @@ -41,6 +43,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Properties; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -65,7 +68,9 @@ void setUp() { void assertCollectWithoutShardingRule() throws SQLException { ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS); when(database.getProtocolType()).thenReturn(databaseType); - Optional actual = statisticsCollector.collect("foo_db", mock(ShardingSphereTable.class), Collections.singletonMap("foo_db", database), mock(RuleMetaData.class)); + ShardingSphereMetaData metaData = new ShardingSphereMetaData( + Collections.singletonMap("foo_db", database), mock(ResourceMetaData.class), mock(RuleMetaData.class), new ConfigurationProperties(new Properties())); + Optional actual = statisticsCollector.collect("foo_db", mock(ShardingSphereTable.class), metaData); assertFalse(actual.isPresent()); } @@ -78,7 +83,9 @@ void assertCollectWithShardingRule() throws SQLException { storageUnits.put("ds_1", mock(StorageUnit.class, RETURNS_DEEP_STUBS)); ShardingSphereDatabase database = new ShardingSphereDatabase( "foo_db", databaseType, new ResourceMetaData(Collections.emptyMap(), storageUnits), new RuleMetaData(Collections.singleton(rule)), Collections.emptyList()); - Optional actual = statisticsCollector.collect("foo_db", mock(ShardingSphereTable.class), Collections.singletonMap("foo_db", database), mock(RuleMetaData.class)); + ShardingSphereMetaData metaData = new ShardingSphereMetaData( + Collections.singletonMap("foo_db", database), mock(ResourceMetaData.class), mock(RuleMetaData.class), new ConfigurationProperties(new Properties())); + Optional actual = statisticsCollector.collect("foo_db", mock(ShardingSphereTable.class), metaData); assertTrue(actual.isPresent()); assertThat(actual.get().getName(), is("sharding_table_statistics")); List actualRows = new ArrayList<>(actual.get().getRows()); diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/MySQLShardingStatisticsTableCollectorTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/MySQLShardingStatisticsTableCollectorTest.java index 2a1f38d49b667..37fe26eb1b5f9 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/MySQLShardingStatisticsTableCollectorTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/MySQLShardingStatisticsTableCollectorTest.java @@ -17,7 +17,9 @@ package org.apache.shardingsphere.sharding.metadata.data.dialect.type; +import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; @@ -44,6 +46,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Properties; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -72,7 +75,9 @@ void assertCollect() throws SQLException { storageUnits.put("ds_1", mockStorageUnit(mockResultSet())); ShardingSphereDatabase database = new ShardingSphereDatabase( "foo_db", databaseType, new ResourceMetaData(Collections.emptyMap(), storageUnits), new RuleMetaData(Collections.singleton(rule)), Collections.emptyList()); - Optional actual = statisticsCollector.collect("foo_db", mock(ShardingSphereTable.class), Collections.singletonMap("foo_db", database), mock(RuleMetaData.class)); + ShardingSphereMetaData metaData = new ShardingSphereMetaData( + Collections.singletonMap("foo_db", database), mock(ResourceMetaData.class), mock(RuleMetaData.class), new ConfigurationProperties(new Properties())); + Optional actual = statisticsCollector.collect("foo_db", mock(ShardingSphereTable.class), metaData); assertTrue(actual.isPresent()); assertThat(actual.get().getName(), is("sharding_table_statistics")); List actualRows = new ArrayList<>(actual.get().getRows()); diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/OpenGaussShardingStatisticsTableCollectorTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/OpenGaussShardingStatisticsTableCollectorTest.java index 184cb025d2100..c5fe41fa48db9 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/OpenGaussShardingStatisticsTableCollectorTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/OpenGaussShardingStatisticsTableCollectorTest.java @@ -17,7 +17,9 @@ package org.apache.shardingsphere.sharding.metadata.data.dialect.type; +import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; @@ -44,6 +46,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Properties; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -73,7 +76,9 @@ void assertCollectWithoutExistedTables() throws SQLException { storageUnits.put("ds_1", mockStorageUnit(mockResultSet(), false)); ShardingSphereDatabase database = new ShardingSphereDatabase( "foo_db", databaseType, new ResourceMetaData(Collections.emptyMap(), storageUnits), new RuleMetaData(Collections.singleton(rule)), Collections.emptyList()); - Optional actual = statisticsCollector.collect("foo_db", mock(ShardingSphereTable.class), Collections.singletonMap("foo_db", database), mock(RuleMetaData.class)); + ShardingSphereMetaData metaData = new ShardingSphereMetaData( + Collections.singletonMap("foo_db", database), mock(ResourceMetaData.class), mock(RuleMetaData.class), new ConfigurationProperties(new Properties())); + Optional actual = statisticsCollector.collect("foo_db", mock(ShardingSphereTable.class), metaData); assertTrue(actual.isPresent()); assertThat(actual.get().getName(), is("sharding_table_statistics")); List actualRows = new ArrayList<>(actual.get().getRows()); @@ -91,7 +96,9 @@ void assertCollectWithExistedTables() throws SQLException { storageUnits.put("ds_1", mockStorageUnit(mockResultSet(), true)); ShardingSphereDatabase database = new ShardingSphereDatabase( "foo_db", databaseType, new ResourceMetaData(Collections.emptyMap(), storageUnits), new RuleMetaData(Collections.singleton(rule)), Collections.emptyList()); - Optional actual = statisticsCollector.collect("foo_db", mock(ShardingSphereTable.class), Collections.singletonMap("foo_db", database), mock(RuleMetaData.class)); + ShardingSphereMetaData metaData = new ShardingSphereMetaData( + Collections.singletonMap("foo_db", database), mock(ResourceMetaData.class), mock(RuleMetaData.class), new ConfigurationProperties(new Properties())); + Optional actual = statisticsCollector.collect("foo_db", mock(ShardingSphereTable.class), metaData); assertTrue(actual.isPresent()); assertThat(actual.get().getName(), is("sharding_table_statistics")); List actualRows = new ArrayList<>(actual.get().getRows()); diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/PostgreSQLShardingStatisticsTableCollectorTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/PostgreSQLShardingStatisticsTableCollectorTest.java index 1eca6b17634c7..2881ef0802b2b 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/PostgreSQLShardingStatisticsTableCollectorTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/data/dialect/type/PostgreSQLShardingStatisticsTableCollectorTest.java @@ -17,7 +17,9 @@ package org.apache.shardingsphere.sharding.metadata.data.dialect.type; +import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; @@ -44,6 +46,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Properties; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -72,7 +75,9 @@ void assertCollect() throws SQLException { storageUnits.put("ds_1", mockStorageUnit(mockResultSet())); ShardingSphereDatabase database = new ShardingSphereDatabase( "foo_db", databaseType, new ResourceMetaData(Collections.emptyMap(), storageUnits), new RuleMetaData(Collections.singleton(rule)), Collections.emptyList()); - Optional actual = statisticsCollector.collect("foo_db", mock(ShardingSphereTable.class), Collections.singletonMap("foo_db", database), mock(RuleMetaData.class)); + ShardingSphereMetaData metaData = new ShardingSphereMetaData( + Collections.singletonMap("foo_db", database), mock(ResourceMetaData.class), mock(RuleMetaData.class), new ConfigurationProperties(new Properties())); + Optional actual = statisticsCollector.collect("foo_db", mock(ShardingSphereTable.class), metaData); assertTrue(actual.isPresent()); assertThat(actual.get().getName(), is("sharding_table_statistics")); List actualRows = new ArrayList<>(actual.get().getRows()); diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/ShardingSphereStatisticsCollector.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/ShardingSphereStatisticsCollector.java index c60fdd5ef62ab..e185216a1dca0 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/ShardingSphereStatisticsCollector.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/ShardingSphereStatisticsCollector.java @@ -17,15 +17,13 @@ package org.apache.shardingsphere.infra.metadata.statistics.collector; -import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; -import org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereTableData; -import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable; +import org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereTableData; import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPI; import java.sql.SQLException; -import java.util.Map; import java.util.Optional; /** @@ -39,10 +37,9 @@ public interface ShardingSphereStatisticsCollector extends TypedSPI { * * @param databaseName database name * @param table table - * @param databases databases - * @param globalRuleMetaData global rule meta data + * @param metaData ShardingSphere meta data * @return ShardingSphere table data * @throws SQLException SQL exception */ - Optional collect(String databaseName, ShardingSphereTable table, Map databases, RuleMetaData globalRuleMetaData) throws SQLException; + Optional collect(String databaseName, ShardingSphereTable table, ShardingSphereMetaData metaData) throws SQLException; } diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/tables/PgClassTableCollector.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/tables/PgClassTableCollector.java index 2008dcd86d7de..d5e33bf3aaaa6 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/tables/PgClassTableCollector.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/tables/PgClassTableCollector.java @@ -18,8 +18,7 @@ package org.apache.shardingsphere.infra.metadata.statistics.collector.tables; import com.cedarsoftware.util.CaseInsensitiveMap; -import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable; import org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereRowData; @@ -45,10 +44,9 @@ public final class PgClassTableCollector implements ShardingSphereStatisticsColl private static final Long PUBLIC_SCHEMA_OID = 0L; @Override - public Optional collect(final String databaseName, final ShardingSphereTable table, final Map databases, - final RuleMetaData globalRuleMetaData) throws SQLException { + public Optional collect(final String databaseName, final ShardingSphereTable table, final ShardingSphereMetaData metaData) throws SQLException { ShardingSphereTableData result = new ShardingSphereTableData(PG_CLASS); - ShardingSphereSchema publicSchema = databases.get(databaseName).getSchema(PUBLIC_SCHEMA); + ShardingSphereSchema publicSchema = metaData.getDatabase(databaseName).getSchema(PUBLIC_SCHEMA); if (null != publicSchema) { result.getRows().addAll(collectForSchema(0L, PUBLIC_SCHEMA_OID, publicSchema, table)); } diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/tables/PgNamespaceTableCollector.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/tables/PgNamespaceTableCollector.java index 83d7eac9d9187..fb00fd536a059 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/tables/PgNamespaceTableCollector.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/tables/PgNamespaceTableCollector.java @@ -18,8 +18,7 @@ package org.apache.shardingsphere.infra.metadata.statistics.collector.tables; import com.cedarsoftware.util.CaseInsensitiveMap; -import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable; import org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereRowData; @@ -44,11 +43,10 @@ public final class PgNamespaceTableCollector implements ShardingSphereStatistics private static final Long PUBLIC_SCHEMA_OID = 0L; @Override - public Optional collect(final String databaseName, final ShardingSphereTable table, final Map databases, - final RuleMetaData globalRuleMetaData) throws SQLException { + public Optional collect(final String databaseName, final ShardingSphereTable table, final ShardingSphereMetaData metaData) throws SQLException { ShardingSphereTableData result = new ShardingSphereTableData(PG_NAMESPACE); long oid = 1L; - for (ShardingSphereSchema each : databases.get(databaseName).getAllSchemas()) { + for (ShardingSphereSchema each : metaData.getDatabase(databaseName).getAllSchemas()) { result.getRows().add(new ShardingSphereRowData(getRow(PUBLIC_SCHEMA.equalsIgnoreCase(each.getName()) ? PUBLIC_SCHEMA_OID : oid++, each.getName(), table))); } return Optional.of(result); 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 7482b8b90d110..df64f20982df9 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 @@ -125,7 +125,7 @@ private void collectForTable(final String databaseName, final String schemaName, Optional tableData = Optional.empty(); if (statisticsCollector.isPresent()) { try { - tableData = statisticsCollector.get().collect(databaseName, table, metaData.getDatabases(), metaData.getGlobalRuleMetaData()); + tableData = statisticsCollector.get().collect(databaseName, table, metaData); // CHECKSTYLE:OFF } catch (final Exception ex) { // CHECKSTYLE:ON diff --git a/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/StatisticsCollectorFixture.java b/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/StatisticsCollectorFixture.java index 83257c6a5dc19..a4835a895e4a9 100644 --- a/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/StatisticsCollectorFixture.java +++ b/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/StatisticsCollectorFixture.java @@ -17,8 +17,7 @@ package org.apache.shardingsphere.mode.fixture; -import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; +import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable; import org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereRowData; import org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereTableData; @@ -26,7 +25,6 @@ import java.sql.SQLException; import java.util.Arrays; -import java.util.Map; import java.util.Optional; /** @@ -35,8 +33,7 @@ public final class StatisticsCollectorFixture implements ShardingSphereStatisticsCollector { @Override - public Optional collect(final String databaseName, final ShardingSphereTable table, final Map databases, - final RuleMetaData globalRuleMetaData) throws SQLException { + public Optional collect(final String databaseName, final ShardingSphereTable table, final ShardingSphereMetaData metaData) throws SQLException { ShardingSphereTableData shardingSphereTableData = new ShardingSphereTableData("test_table"); shardingSphereTableData.getRows().add(new ShardingSphereRowData(Arrays.asList("1", "2"))); return Optional.of(shardingSphereTableData);