From 1e2fe35851f21809c34027e4fba2d5772a7fb006 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Sun, 8 Oct 2023 23:32:36 +0800 Subject: [PATCH] Refactor ShowStorageUnitExecutor (#28689) * Refactor ShowStorageUnitExecutor * Refactor ShowStorageUnitExecutor * Refactor SQLFederationRuleConfiguration --- .../api/config/SQLFederationRuleConfiguration.java | 2 +- .../handler/query/ShowSQLFederationRuleExecutor.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/sql-federation/api/src/main/java/org/apache/shardingsphere/sqlfederation/api/config/SQLFederationRuleConfiguration.java b/kernel/sql-federation/api/src/main/java/org/apache/shardingsphere/sqlfederation/api/config/SQLFederationRuleConfiguration.java index e1c09e0d13a56..757f982f08c9f 100644 --- a/kernel/sql-federation/api/src/main/java/org/apache/shardingsphere/sqlfederation/api/config/SQLFederationRuleConfiguration.java +++ b/kernel/sql-federation/api/src/main/java/org/apache/shardingsphere/sqlfederation/api/config/SQLFederationRuleConfiguration.java @@ -26,9 +26,9 @@ /** * SQL federation rule configuration. */ +@RequiredArgsConstructor @Getter @Setter -@RequiredArgsConstructor public final class SQLFederationRuleConfiguration implements GlobalRuleConfiguration { private final boolean sqlFederationEnabled; diff --git a/kernel/sql-federation/distsql/handler/src/main/java/org/apache/shardingsphere/sqlfederation/distsql/handler/query/ShowSQLFederationRuleExecutor.java b/kernel/sql-federation/distsql/handler/src/main/java/org/apache/shardingsphere/sqlfederation/distsql/handler/query/ShowSQLFederationRuleExecutor.java index 801d16d346817..f91ae15b29af6 100644 --- a/kernel/sql-federation/distsql/handler/src/main/java/org/apache/shardingsphere/sqlfederation/distsql/handler/query/ShowSQLFederationRuleExecutor.java +++ b/kernel/sql-federation/distsql/handler/src/main/java/org/apache/shardingsphere/sqlfederation/distsql/handler/query/ShowSQLFederationRuleExecutor.java @@ -36,8 +36,10 @@ public final class ShowSQLFederationRuleExecutor implements MetaDataRequiredQuer @Override public Collection getRows(final ShardingSphereMetaData metaData, final ShowSQLFederationRuleStatement sqlStatement) { SQLFederationRuleConfiguration ruleConfig = metaData.getGlobalRuleMetaData().getSingleRule(SQLFederationRule.class).getConfiguration(); - return Collections.singleton(new LocalDataQueryResultRow(String.valueOf(ruleConfig.isSqlFederationEnabled()), - null != ruleConfig.getExecutionPlanCache() ? ruleConfig.getExecutionPlanCache().toString() : "")); + String sqlFederationEnabled = String.valueOf(ruleConfig.isSqlFederationEnabled()); + String executionPlanCache = null != ruleConfig.getExecutionPlanCache() ? ruleConfig.getExecutionPlanCache().toString() : ""; + LocalDataQueryResultRow row = new LocalDataQueryResultRow(sqlFederationEnabled, executionPlanCache); + return Collections.singleton(row); } @Override