Vladsz83 commented on a change in pull request #9665:
URL: https://github.com/apache/ignite/pull/9665#discussion_r771861161
##########
File path:
modules/core/src/main/java/org/apache/ignite/internal/binary/BinarySerializedFieldComparator.java
##########
@@ -247,55 +246,16 @@ public static boolean
equals(BinarySerializedFieldComparator c1, BinarySerialize
Object val1 = c1.currentField();
Object val2 = c2.currentField();
- return isArray(val1) ? compareArrays(val1, val2) : F.eq(val1,
val2);
+ return isArray(val1) ? F.arrayEq(val1, val2) : F.eq(val1,
val2);
}
}
- /**
- * Compare arrays.
- *
- * @param val1 Value 1.
- * @param val2 Value 2.
- * @return Result.
- */
- private static boolean compareArrays(Object val1, Object val2) {
- if (val1.getClass() == val2.getClass()) {
- if (val1 instanceof byte[])
- return Arrays.equals((byte[])val1, (byte[])val2);
- else if (val1 instanceof boolean[])
- return Arrays.equals((boolean[])val1, (boolean[])val2);
- else if (val1 instanceof short[])
- return Arrays.equals((short[])val1, (short[])val2);
- else if (val1 instanceof char[])
- return Arrays.equals((char[])val1, (char[])val2);
- else if (val1 instanceof int[])
- return Arrays.equals((int[])val1, (int[])val2);
- else if (val1 instanceof long[])
- return Arrays.equals((long[])val1, (long[])val2);
- else if (val1 instanceof float[])
- return Arrays.equals((float[])val1, (float[])val2);
- else if (val1 instanceof double[])
- return Arrays.equals((double[])val1, (double[])val2);
- else if (val1 instanceof BinaryArray) {
- BinaryArray arr1 = (BinaryArray)val1;
- BinaryArray arr2 = (BinaryArray)val2;
-
- return arr1.componentTypeId() == arr2.componentTypeId()
- && Arrays.deepEquals(arr1.array(), arr2.array());
- }
- else
- return Arrays.deepEquals((Object[])val1, (Object[])val2);
- }
-
- return false;
- }
-
/**
* @param field Field.
* @return {@code True} if field is array.
*/
private static boolean isArray(@Nullable Object field) {
- return field != null && (field.getClass().isArray() || field
instanceof BinaryArray);
+ return F.isArray(field) || field instanceof BinaryArray;
Review comment:
Should we remane BinarySerializedFieldComparator#isArray() to something
like isArrayOrBinaryArray() or fix its description? It looks a bit wierd
compared to F.isArray().
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]