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

jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 21a23967d7c Fix error compare method in IT framework
21a23967d7c is described below

commit 21a23967d7c7affe9ae4d64a9dbd1a937599c7f7
Author: Chen YZ <[email protected]>
AuthorDate: Mon May 27 09:48:53 2024 +0800

    Fix error compare method in IT framework
---
 .../iotdb/itbase/runtime/RequestDelegate.java      | 26 +++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git 
a/integration-test/src/main/java/org/apache/iotdb/itbase/runtime/RequestDelegate.java
 
b/integration-test/src/main/java/org/apache/iotdb/itbase/runtime/RequestDelegate.java
index 99ecbf40a6a..bc32c31e793 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/itbase/runtime/RequestDelegate.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/itbase/runtime/RequestDelegate.java
@@ -79,13 +79,37 @@ public abstract class RequestDelegate<T> {
     T data = results.get(0);
     for (int i = 1; i < results.size(); i++) {
       T anotherData = results.get(i);
-      if (!Objects.equals(data, anotherData)) {
+      if (!compare(data, anotherData)) {
         throw new InconsistentDataException(results, endpoints);
       }
     }
     return data;
   }
 
+  private boolean compare(T data, T anotherData) {
+    if (data instanceof byte[] && anotherData instanceof byte[]) {
+      return Arrays.equals((byte[]) data, (byte[]) anotherData);
+    } else if (data instanceof short[] && anotherData instanceof short[]) {
+      return Arrays.equals((short[]) data, (short[]) anotherData);
+    } else if (data instanceof int[] && anotherData instanceof int[]) {
+      return Arrays.equals((int[]) data, (int[]) anotherData);
+    } else if (data instanceof long[] && anotherData instanceof long[]) {
+      return Arrays.equals((long[]) data, (long[]) anotherData);
+    } else if (data instanceof char[] && anotherData instanceof char[]) {
+      return Arrays.equals((char[]) data, (char[]) anotherData);
+    } else if (data instanceof float[] && anotherData instanceof float[]) {
+      return Arrays.equals((float[]) data, (float[]) anotherData);
+    } else if (data instanceof double[] && anotherData instanceof double[]) {
+      return Arrays.equals((double[]) data, (double[]) anotherData);
+    } else if (data instanceof boolean[] && anotherData instanceof boolean[]) {
+      return Arrays.equals((boolean[]) data, (boolean[]) anotherData);
+    } else if (data instanceof Object[] && anotherData instanceof Object[]) {
+      return Arrays.equals((Object[]) data, (Object[]) anotherData);
+    } else {
+      return Objects.equals(data, anotherData);
+    }
+  }
+
   protected void handleExceptions(Exception[] exceptions) throws SQLException {
     if (exceptions.length == 0) {
       return;

Reply via email to