This is an automated email from the ASF dual-hosted git repository.
terrymanu 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 7adedc38244 Fix empty rows returned by SHOW SHADOW TABLE RULE for
specified table (#39739)
7adedc38244 is described below
commit 7adedc38244089bdf4a41292f876991be10540c9
Author: Eunbin Son <[email protected]>
AuthorDate: Tue Sep 8 19:21:53 2026 +0900
Fix empty rows returned by SHOW SHADOW TABLE RULE for specified table
(#39739)
Co-authored-by: Liang Zhang <[email protected]>
---
RELEASE-NOTES.md | 1 +
.../handler/query/ShowShadowTableRulesExecutor.java | 17 ++++-------------
.../cases/show-shadow-table-rules-current-config.yaml | 3 +++
.../test/resources/cases/show-shadow-table-rules.xml | 3 +++
4 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 628090686a6..454412ced12 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -42,6 +42,7 @@
1. Metadata: Fix wrong logic table metadata when config same actual table name
in different storage unit -
[#39157](https://github.com/apache/shardingsphere/pull/39157)
1. DistSQL: Fix case-sensitive storage unit matching in `SHOW RULES USED
STORAGE UNIT` - [#38848](https://github.com/apache/shardingsphere/pull/38848)
1. DistSQL: Use case-insensitive table name matching in broadcast create and
drop executors - [#39200](https://github.com/apache/shardingsphere/pull/39200)
+1. DistSQL: Fix empty rows returned by SHOW SHADOW TABLE RULE for specified
table - [#39739](https://github.com/apache/shardingsphere/pull/39739)
1. DistSQL: Fix `CREATE READWRITE_SPLITTING RULE IF NOT EXISTS` failing for an
existing rule name -
[#39371](https://github.com/apache/shardingsphere/pull/39371)
1. DistSQL: Match mask table names case-insensitively in create and alter
executors - [#39361](https://github.com/apache/shardingsphere/pull/39361)
1. JDBC: Fix stale generated values leaking into prepared statement
executeBatch calls without pending batches -
[#38160](https://github.com/apache/shardingsphere/pull/38160)
diff --git
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowTableRulesExecutor.java
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowTableRulesExecutor.java
index 1fd89d84715..b1441753ab4 100644
---
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowTableRulesExecutor.java
+++
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowTableRulesExecutor.java
@@ -58,23 +58,14 @@ public final class ShowShadowTableRulesExecutor implements
DistSQLQueryExecutor<
private Collection<Map<String, String>> buildData(final
ShadowRuleConfiguration ruleConfig, final ShowShadowTableRulesStatement
sqlStatement) {
Collection<Map<String, String>> result = new ArrayList<>();
- if (isSpecified(sqlStatement)) {
- ruleConfig.getTables().forEach((key, value) -> {
- Map<String, String> map = new HashMap<>();
- if (key.equalsIgnoreCase(sqlStatement.getTableName())) {
- map.put(SHADOW_TABLE, key);
- map.put(SHADOW_ALGORITHM_NAME,
convertToString(value.getShadowAlgorithmNames()));
- }
- result.add(map);
- });
- } else {
- ruleConfig.getTables().forEach((key, value) -> {
+ ruleConfig.getTables().forEach((key, value) -> {
+ if (!isSpecified(sqlStatement) ||
key.equalsIgnoreCase(sqlStatement.getTableName())) {
Map<String, String> map = new HashMap<>();
map.put(SHADOW_TABLE, key);
map.put(SHADOW_ALGORITHM_NAME,
convertToString(value.getShadowAlgorithmNames()));
result.add(map);
- });
- }
+ }
+ });
return result;
}
diff --git
a/features/shadow/distsql/handler/src/test/resources/cases/show-shadow-table-rules-current-config.yaml
b/features/shadow/distsql/handler/src/test/resources/cases/show-shadow-table-rules-current-config.yaml
index ef87e26d7de..154165a8ca1 100644
---
a/features/shadow/distsql/handler/src/test/resources/cases/show-shadow-table-rules-current-config.yaml
+++
b/features/shadow/distsql/handler/src/test/resources/cases/show-shadow-table-rules-current-config.yaml
@@ -22,6 +22,9 @@ rules:
shadowAlgorithmNames:
- shadowAlgorithmName_1
- shadowAlgorithmName_2
+ t_order_item:
+ shadowAlgorithmNames:
+ - shadowAlgorithmName_1
shadowAlgorithms:
shadowAlgorithmName_1:
type: SQL_HINT
diff --git
a/features/shadow/distsql/handler/src/test/resources/cases/show-shadow-table-rules.xml
b/features/shadow/distsql/handler/src/test/resources/cases/show-shadow-table-rules.xml
index 61fc4230eff..5849a3b9699 100644
---
a/features/shadow/distsql/handler/src/test/resources/cases/show-shadow-table-rules.xml
+++
b/features/shadow/distsql/handler/src/test/resources/cases/show-shadow-table-rules.xml
@@ -22,6 +22,9 @@
<expected-query-result-row>
t_order|shadowAlgorithmName_1,shadowAlgorithmName_2
</expected-query-result-row>
+ <expected-query-result-row>
+ t_order_item|shadowAlgorithmName_1
+ </expected-query-result-row>
</expected-query-result-rows>
</test-case>
<test-case dist-sql="SHOW SHADOW TABLE RULE t_order FROM foo_db"
current-rule-config-yaml-file="cases/show-shadow-table-rules-current-config.yaml">