Jackie-Jiang commented on code in PR #11453:
URL: https://github.com/apache/pinot/pull/11453#discussion_r1309353767
##########
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:
Correct. These conversion happens only when we need to switch between
internal type and external type. During query time, that can happen during
scalar function invocation and final result rendering.
--
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]