tuichenchuxin commented on code in PR #28620:
URL: https://github.com/apache/shardingsphere/pull/28620#discussion_r1349604511
##########
infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/builder/dialect/MySQLShardingSphereStatisticsBuilder.java:
##########
@@ -28,38 +28,60 @@
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
-import java.util.Optional;
+import java.util.Arrays;
import java.util.Collections;
+import java.util.HashSet;
import java.util.Map.Entry;
+import java.util.Optional;
+import java.util.Set;
/**
* ShardingSphere statistics builder for MySQL.
*/
public final class MySQLShardingSphereStatisticsBuilder implements
ShardingSphereStatisticsBuilder {
+ private static final Set<String> CURRENT_SUPPORT = new
HashSet<>(Arrays.asList("PARAMETERS"));
+
private static final String SHARDING_SPHERE = "shardingsphere";
+ private static final String INFORMATION_SCHEMA = "information_schema";
+
private static final String CLUSTER_INFORMATION = "cluster_information";
@Override
public ShardingSphereStatistics build(final ShardingSphereMetaData
metaData) {
ShardingSphereStatistics result = new ShardingSphereStatistics();
Optional<ShardingSphereSchema> shardingSphereSchema =
Optional.ofNullable(metaData.getDatabase(SHARDING_SPHERE)).map(database ->
database.getSchema(SHARDING_SPHERE));
- if (!shardingSphereSchema.isPresent()) {
- return result;
+ if (shardingSphereSchema.isPresent()) {
+ ShardingSphereSchemaData schemaData = new
ShardingSphereSchemaData();
+ for (Entry<String, ShardingSphereTable> entry :
shardingSphereSchema.get().getTables().entrySet()) {
+ ShardingSphereTableData tableData = new
ShardingSphereTableData(entry.getValue().getName());
+ if (CLUSTER_INFORMATION.equals(entry.getKey())) {
+ tableData.getRows().add(new
ShardingSphereRowData(Collections.singletonList(ShardingSphereVersion.VERSION)));
+ }
+ schemaData.getTableData().put(entry.getKey(), tableData);
+ }
+ ShardingSphereDatabaseData databaseData = new
ShardingSphereDatabaseData();
+ databaseData.getSchemaData().put(SHARDING_SPHERE, schemaData);
+ result.getDatabaseData().put(SHARDING_SPHERE, databaseData);
}
- ShardingSphereSchemaData schemaData = new ShardingSphereSchemaData();
- for (Entry<String, ShardingSphereTable> entry :
shardingSphereSchema.get().getTables().entrySet()) {
- ShardingSphereTableData tableData = new
ShardingSphereTableData(entry.getValue().getName());
- if (CLUSTER_INFORMATION.equals(entry.getKey())) {
- tableData.getRows().add(new
ShardingSphereRowData(Collections.singletonList(ShardingSphereVersion.VERSION)));
+
+ Optional<ShardingSphereSchema> informationSchemaSchema =
Optional.ofNullable(metaData.getDatabase("information_schema")).map(database ->
database.getSchema("information_schema"));
Review Comment:
I think `information_schema` should in `shardingsphere` database.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]