You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/01/15 11:38:07 UTC

[shardingsphere] branch master updated: Scaling data consistency check supports PostgreSQL xml data type (#14799)

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

zhonghongsheng 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 6d09bc0  Scaling data consistency check supports PostgreSQL xml data type (#14799)
6d09bc0 is described below

commit 6d09bc019ff82e5927cc9bcba7cecd731fb406cf
Author: ReyYang <yi...@163.com>
AuthorDate: Sat Jan 15 19:37:11 2022 +0800

    Scaling data consistency check supports PostgreSQL xml data type (#14799)
---
 .../check/consistency/DataMatchSingleTableDataCalculator.java  | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/spi/check/consistency/DataMatchSingleTableDataCalculator.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/spi/check/consistency/DataMatchSingleTableDataCalculator.java
index d02b736..8c810f5 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/spi/check/consistency/DataMatchSingleTableDataCalculator.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/spi/check/consistency/DataMatchSingleTableDataCalculator.java
@@ -21,6 +21,7 @@ import com.google.common.base.Strings;
 import lombok.Getter;
 import lombok.NonNull;
 import lombok.RequiredArgsConstructor;
+import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
@@ -36,6 +37,7 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
+import java.sql.SQLXML;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -126,6 +128,7 @@ public final class DataMatchSingleTableDataCalculator extends AbstractStreamingS
         
         private final Collection<Collection<Object>> records;
     
+        @SneakyThrows
         @Override
         public boolean equals(final Object o) {
             if (this == o) {
@@ -153,7 +156,12 @@ public final class DataMatchSingleTableDataCalculator extends AbstractStreamingS
                 Iterator<Object> thisNextIterator = thisNext.iterator();
                 Iterator<Object> thatNextIterator = thatNext.iterator();
                 while (thisNextIterator.hasNext() && thatNextIterator.hasNext()) {
-                    if (!new EqualsBuilder().append(thisNextIterator.next(), thatNextIterator.next()).isEquals()) {
+                    Object thisResult = thisNextIterator.next();
+                    Object thatResult = thatNextIterator.next();
+                    if (thisResult instanceof SQLXML && thatResult instanceof SQLXML) {
+                        return ((SQLXML) thisResult).getString().equals(((SQLXML) thatResult).getString());
+                    }
+                    if (!new EqualsBuilder().append(thisResult, thatResult).isEquals()) {
                         return false;
                     }
                 }