This is an automated email from the ASF dual-hosted git repository. duanzhengqiang 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 d3cdc0c9904 Optimize system table judgment in SimpleTableSegmentBinder (#34078) d3cdc0c9904 is described below commit d3cdc0c99041272f881746117b94f91d661bcc3d Author: jiangML <1060319...@qq.com> AuthorDate: Tue Dec 17 10:49:46 2024 +0800 Optimize system table judgment in SimpleTableSegmentBinder (#34078) --- .../segment/from/type/SimpleTableSegmentBinder.java | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/from/type/SimpleTableSegmentBinder.java b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/from/type/SimpleTableSegmentBinder.java index a23f43f48d4..d94ad27e23e 100644 --- a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/from/type/SimpleTableSegmentBinder.java +++ b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/from/type/SimpleTableSegmentBinder.java @@ -18,7 +18,6 @@ package org.apache.shardingsphere.infra.binder.engine.segment.from.type; import com.cedarsoftware.util.CaseInsensitiveMap.CaseInsensitiveString; -import com.cedarsoftware.util.CaseInsensitiveSet; import com.google.common.collect.Multimap; import lombok.AccessLevel; import lombok.NoArgsConstructor; @@ -58,23 +57,8 @@ import java.util.Optional; @NoArgsConstructor(access = AccessLevel.PRIVATE) public final class SimpleTableSegmentBinder { - private static final Collection<String> SYSTEM_CATALOG_TABLES = new CaseInsensitiveSet<>(10, 1F); - private static final String PG_CATALOG = "pg_catalog"; - static { - SYSTEM_CATALOG_TABLES.add("pg_class"); - SYSTEM_CATALOG_TABLES.add("pg_database"); - SYSTEM_CATALOG_TABLES.add("pg_tables"); - SYSTEM_CATALOG_TABLES.add("pg_roles"); - SYSTEM_CATALOG_TABLES.add("pg_settings"); - SYSTEM_CATALOG_TABLES.add("pg_depend"); - SYSTEM_CATALOG_TABLES.add("pg_attribute"); - SYSTEM_CATALOG_TABLES.add("pg_attrdef"); - SYSTEM_CATALOG_TABLES.add("pg_type"); - SYSTEM_CATALOG_TABLES.add("pg_description"); - } - /** * Bind simple table segment. * @@ -118,7 +102,8 @@ public final class SimpleTableSegmentBinder { } // TODO getSchemaName according to search path DatabaseType databaseType = binderContext.getDatabaseType(); - if ((databaseType instanceof PostgreSQLDatabaseType || databaseType instanceof OpenGaussDatabaseType) && SYSTEM_CATALOG_TABLES.contains(segment.getTableName().getIdentifier().getValue())) { + if ((databaseType instanceof PostgreSQLDatabaseType || databaseType instanceof OpenGaussDatabaseType) + && SystemSchemaManager.isSystemTable(databaseType.getType(), PG_CATALOG, segment.getTableName().getIdentifier().getValue())) { return new IdentifierValue(PG_CATALOG); } return new IdentifierValue(new DatabaseTypeRegistry(databaseType).getDefaultSchemaName(binderContext.getCurrentDatabaseName()));