gortiz commented on code in PR #11453:
URL: https://github.com/apache/pinot/pull/11453#discussion_r1308286488
##########
pinot-common/src/main/java/org/apache/pinot/common/utils/DataSchema.java:
##########
@@ -534,43 +527,58 @@ private static long[] toLongArray(Object value) {
}
}
- private static int[] toIntArray(Object value) {
- if (value instanceof int[]) {
- return (int[]) value;
- } else if (value instanceof IntArrayList) {
- return ((IntArrayList) value).elements();
- } else {
- long[] longValues = (long[]) value;
- int length = longValues.length;
- int[] intValues = new int[length];
- for (int i = 0; i < length; i++) {
- intValues[i] = (int) longValues[i];
- }
- return intValues;
+ private static boolean[] toBooleanArray(int[] intArray) {
+ int length = intArray.length;
+ boolean[] booleanArray = new boolean[length];
+ for (int i = 0; i < length; i++) {
+ booleanArray[i] = intArray[i] == 1;
}
+ return booleanArray;
}
- private static boolean[] toBooleanArray(Object value) {
- int[] ints = (int[]) value;
- boolean[] booleans = new boolean[ints.length];
- for (int i = 0; i < ints.length; i++) {
- booleans[i] = ints[i] == 1;
+ private static int[] fromBooleanArray(boolean[] booleanArray) {
Review Comment:
here, for example, we are wasting a lot of memory in case the array is not
small. This is only used for multivalued booleans? If that I guess it is not
that bad because it shouldn't be used that often
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]