You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ch...@apache.org on 2024/05/07 03:39:54 UTC

(shardingsphere) branch master updated: Add enum process on RepositoryTupleSwapperEngine (#31153)

This is an automated email from the ASF dual-hosted git repository.

chengzhang 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 650b0e241c2 Add enum process on  RepositoryTupleSwapperEngine (#31153)
650b0e241c2 is described below

commit 650b0e241c2168e85e26c07466978fb589eb6331
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Tue May 7 11:39:48 2024 +0800

    Add enum process on  RepositoryTupleSwapperEngine (#31153)
    
    * Add enum process on  RepositoryTupleSwapperEngine
    
    * Add enum process on  RepositoryTupleSwapperEngine
---
 .../broadcast/yaml/config/YamlBroadcastRuleConfiguration.java          | 2 +-
 .../shardingsphere/mode/engine/RepositoryTupleSwapperEngine.java       | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/config/YamlBroadcastRuleConfiguration.java b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/config/YamlBroadcastRuleConfiguration.java
index f821680c1de..4cb41c916a6 100644
--- a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/config/YamlBroadcastRuleConfiguration.java
+++ b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/config/YamlBroadcastRuleConfiguration.java
@@ -38,7 +38,7 @@ import java.util.LinkedList;
 @Setter
 public final class YamlBroadcastRuleConfiguration implements YamlRuleConfiguration {
     
-    @RepositoryTupleField(value = BroadcastRuleNodePathProvider.TABLES, type = Type.ALGORITHM)
+    @RepositoryTupleField(value = BroadcastRuleNodePathProvider.TABLES, type = Type.TABLE)
     private Collection<String> tables = new LinkedList<>();
     
     @Override
diff --git a/mode/api/src/main/java/org/apache/shardingsphere/mode/engine/RepositoryTupleSwapperEngine.java b/mode/api/src/main/java/org/apache/shardingsphere/mode/engine/RepositoryTupleSwapperEngine.java
index 88ccf234037..13e0ea551f8 100644
--- a/mode/api/src/main/java/org/apache/shardingsphere/mode/engine/RepositoryTupleSwapperEngine.java
+++ b/mode/api/src/main/java/org/apache/shardingsphere/mode/engine/RepositoryTupleSwapperEngine.java
@@ -115,6 +115,9 @@ public final class RepositoryTupleSwapperEngine {
         if (fieldValue instanceof Boolean || fieldValue instanceof Integer || fieldValue instanceof Long) {
             return Collections.singleton(new RepositoryTuple(ruleNodePath.getUniqueItem(tupleField.value()).getPath(), fieldValue.toString()));
         }
+        if (fieldValue instanceof Enum) {
+            return Collections.singleton(new RepositoryTuple(ruleNodePath.getUniqueItem(tupleField.value()).getPath(), ((Enum) fieldValue).name()));
+        }
         return Collections.singleton(new RepositoryTuple(ruleNodePath.getUniqueItem(tupleField.value()).getPath(), YamlEngine.marshal(fieldValue)));
     }