alex-plekhanov commented on a change in pull request #9490:
URL: https://github.com/apache/ignite/pull/9490#discussion_r759125191
##########
File path:
modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
##########
@@ -2554,6 +2591,41 @@ public static void validateEnumValues(String typeName,
@Nullable Map<String, Int
return mergedMap;
}
+ /**
+ * @param obj {@link BinaryArray} or {@code Object[]}.
+ * @return Objects array.
+ */
+ public static Object[] rawArrayFromBinary(Object obj) {
+ if (obj instanceof BinaryArray)
+ // We want raw data(no deserialization).
+ return ((BinaryArray)obj).array();
+ else
+ // This can happen even in BinaryArray.USE_TYPED_ARRAY = true.
+ // In case user pass special array type to arguments, String[],
for example.
+ return (Object[])obj;
+ }
+
+ /** */
+ public static Object[] rawArrayInArgs(Object[] args, boolean keepBinary) {
+ if (args == null)
+ return args;
+
+ for (int i = 0; i < args.length; i++) {
+ if (args[i] instanceof BinaryArray) {
+ BinaryArray arr = (BinaryArray)args[i];
+
+ args[i] = keepBinary ? arr.array() : arr.deserialize();
+ }
+ }
+
+ return args;
+ }
+
+ /** */
+ public static boolean isObjectArray(Class<?> cls) {
+ return Object[].class == cls || BinaryArray.class == cls;
Review comment:
There are several `val instanceof BinaryArray` calls, so any child class
of BinaryArray will also fit this condition. For consistency, I think, it's
better to keep the same semantic here (not only BinaryArray class itself but
also any of its child). But we don't have a BinaryArray child now, so it's up
to you, you can leave it as is.
--
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]