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 395ccef894d Refactor EnumerableScanExecutor to use
DatabaseTypeRegistry for system table option checks (#35281)
395ccef894d is described below
commit 395ccef894de8f9a67daf74e87413da7cb550d4d
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Apr 28 15:41:39 2025 +0800
Refactor EnumerableScanExecutor to use DatabaseTypeRegistry for system
table option checks (#35281)
---
.../sqlfederation/executor/enumerable/EnumerableScanExecutor.java | 5 +++--
.../sqlfederation/executor/utils/StatisticsAssembleUtils.java | 1 -
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git
a/kernel/sql-federation/executor/src/main/java/org/apache/shardingsphere/sqlfederation/executor/enumerable/EnumerableScanExecutor.java
b/kernel/sql-federation/executor/src/main/java/org/apache/shardingsphere/sqlfederation/executor/enumerable/EnumerableScanExecutor.java
index 99c732ac354..df623646c1f 100644
---
a/kernel/sql-federation/executor/src/main/java/org/apache/shardingsphere/sqlfederation/executor/enumerable/EnumerableScanExecutor.java
+++
b/kernel/sql-federation/executor/src/main/java/org/apache/shardingsphere/sqlfederation/executor/enumerable/EnumerableScanExecutor.java
@@ -27,7 +27,7 @@ import
org.apache.shardingsphere.infra.binder.engine.SQLBindEngine;
import org.apache.shardingsphere.infra.connection.kernel.KernelProcessor;
import
org.apache.shardingsphere.infra.database.core.metadata.database.system.SystemDatabase;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
-import
org.apache.shardingsphere.infra.database.opengauss.type.OpenGaussDatabaseType;
+import org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import
org.apache.shardingsphere.infra.exception.kernel.connection.SQLExecutionInterruptedException;
import org.apache.shardingsphere.infra.executor.kernel.model.ExecutionGroup;
@@ -153,7 +153,8 @@ public final class EnumerableScanExecutor implements
ScanExecutor {
}
private Enumerable<Object> createMemoryEnumerable(final String
databaseName, final String schemaName, final ShardingSphereTable table, final
DatabaseType databaseType) {
- if (databaseType instanceof OpenGaussDatabaseType &&
EnumerableConstants.SYSTEM_CATALOG_TABLES.contains(table.getName())) {
+ if (new
DatabaseTypeRegistry(databaseType).getDialectDatabaseMetaData().getSystemTableOption().isDriverQuerySystemCatalog()
+ &&
EnumerableConstants.SYSTEM_CATALOG_TABLES.contains(table.getName())) {
return
createMemoryEnumerator(StatisticsAssembleUtils.assembleTableStatistics(table,
federationContext.getMetaData()), table, databaseType);
}
Optional<TableStatistics> tableStatistics =
Optional.ofNullable(statistics.getDatabaseStatistics(databaseName))
diff --git
a/kernel/sql-federation/executor/src/main/java/org/apache/shardingsphere/sqlfederation/executor/utils/StatisticsAssembleUtils.java
b/kernel/sql-federation/executor/src/main/java/org/apache/shardingsphere/sqlfederation/executor/utils/StatisticsAssembleUtils.java
index 3121eed3510..1be63f4a0c6 100644
---
a/kernel/sql-federation/executor/src/main/java/org/apache/shardingsphere/sqlfederation/executor/utils/StatisticsAssembleUtils.java
+++
b/kernel/sql-federation/executor/src/main/java/org/apache/shardingsphere/sqlfederation/executor/utils/StatisticsAssembleUtils.java
@@ -46,7 +46,6 @@ public final class StatisticsAssembleUtils {
* @return table statistics
*/
public static TableStatistics assembleTableStatistics(final
ShardingSphereTable table, final ShardingSphereMetaData metaData) {
- // TODO move this logic to ShardingSphere statistics
TableStatistics result = new TableStatistics(table.getName());
if (EnumerableConstants.PG_DATABASE.equalsIgnoreCase(table.getName()))
{
assembleOpenGaussDatabaseData(result, metaData.getAllDatabases());