Skip to content

Commit 1b9aa40

Browse files
committed
done
1 parent 9a29af7 commit 1b9aa40

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

integration-test/src/main/java/org/apache/iotdb/itbase/runtime/RequestDelegate.java

+25-1
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,37 @@ public final T requestAllAndCompare() throws SQLException {
7979
T data = results.get(0);
8080
for (int i = 1; i < results.size(); i++) {
8181
T anotherData = results.get(i);
82-
if (!Objects.equals(data, anotherData)) {
82+
if (!compare(data, anotherData)) {
8383
throw new InconsistentDataException(results, endpoints);
8484
}
8585
}
8686
return data;
8787
}
8888

89+
private boolean compare(T data, T anotherData) {
90+
if (data instanceof byte[] && anotherData instanceof byte[]) {
91+
return Arrays.equals((byte[]) data, (byte[]) anotherData);
92+
} else if (data instanceof short[] && anotherData instanceof short[]) {
93+
return Arrays.equals((short[]) data, (short[]) anotherData);
94+
} else if (data instanceof int[] && anotherData instanceof int[]) {
95+
return Arrays.equals((int[]) data, (int[]) anotherData);
96+
} else if (data instanceof long[] && anotherData instanceof long[]) {
97+
return Arrays.equals((long[]) data, (long[]) anotherData);
98+
} else if (data instanceof char[] && anotherData instanceof char[]) {
99+
return Arrays.equals((char[]) data, (char[]) anotherData);
100+
} else if (data instanceof float[] && anotherData instanceof float[]) {
101+
return Arrays.equals((float[]) data, (float[]) anotherData);
102+
} else if (data instanceof double[] && anotherData instanceof double[]) {
103+
return Arrays.equals((double[]) data, (double[]) anotherData);
104+
} else if (data instanceof boolean[] && anotherData instanceof boolean[]) {
105+
return Arrays.equals((boolean[]) data, (boolean[]) anotherData);
106+
} else if (data instanceof Object[] && anotherData instanceof Object[]) {
107+
return Arrays.equals((Object[]) data, (Object[]) anotherData);
108+
} else {
109+
return Objects.equals(data, anotherData);
110+
}
111+
}
112+
89113
protected void handleExceptions(Exception[] exceptions) throws SQLException {
90114
if (exceptions.length == 0) {
91115
return;

0 commit comments

Comments
 (0)