You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2025/05/01 06:59:47 UTC
(shardingsphere) branch master updated: Optimize table type array in SchemaMetaDataLoader (#35307)
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 8c3d4ba99c4 Optimize table type array in SchemaMetaDataLoader (#35307)
8c3d4ba99c4 is described below
commit 8c3d4ba99c42a000b7d0d4160fb216491c065170
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Thu May 1 14:59:40 2025 +0800
Optimize table type array in SchemaMetaDataLoader (#35307)
- Replace the inline string array with a named variable for better readability
- Simplify the getTables method call by using a variable for table types
---
.../core/metadata/data/loader/type/SchemaMetaDataLoader.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/metadata/data/loader/type/SchemaMetaDataLoader.java b/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/metadata/data/loader/type/SchemaMetaDataLoader.java
index 45c60069486..570df6e20eb 100644
--- a/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/metadata/data/loader/type/SchemaMetaDataLoader.java
+++ b/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/metadata/data/loader/type/SchemaMetaDataLoader.java
@@ -109,9 +109,8 @@ public final class SchemaMetaDataLoader {
private Collection<String> loadTableNames(final Connection connection, final String schemaName, final Collection<String> excludedTables) throws SQLException {
Collection<String> result = new CaseInsensitiveSet<>();
- try (
- ResultSet resultSet = connection.getMetaData().getTables(connection.getCatalog(), schemaName, null,
- new String[]{TABLE_TYPE, PARTITIONED_TABLE_TYPE, VIEW_TYPE, SYSTEM_TABLE_TYPE, SYSTEM_VIEW_TYPE})) {
+ String[] tableTypes = new String[]{TABLE_TYPE, PARTITIONED_TABLE_TYPE, VIEW_TYPE, SYSTEM_TABLE_TYPE, SYSTEM_VIEW_TYPE};
+ try (ResultSet resultSet = connection.getMetaData().getTables(connection.getCatalog(), schemaName, null, tableTypes)) {
while (resultSet.next()) {
String table = resultSet.getString(TABLE_NAME);
if (!isSystemTable(table) && !excludedTables.contains(table)) {