Jackie-Jiang commented on code in PR #13673: URL: https://github.com/apache/pinot/pull/13673#discussion_r1725782571
########## pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java: ########## @@ -343,21 +346,124 @@ public static Object getLiteralValue(Literal literal) { case BINARY_VALUE: return literal.getBinaryValue(); case INT_ARRAY_VALUE: - return literal.getIntArrayValue().stream().mapToInt(Integer::intValue).toArray(); + return getIntArrayValue(literal); case LONG_ARRAY_VALUE: - return literal.getLongArrayValue().stream().mapToLong(Long::longValue).toArray(); + return getLongArrayValue(literal); case FLOAT_ARRAY_VALUE: - List<Integer> floatList = literal.getFloatArrayValue(); - int numFloats = floatList.size(); - float[] floatArray = new float[numFloats]; - for (int i = 0; i < numFloats; i++) { - floatArray[i] = Float.intBitsToFloat(floatList.get(i)); - } - return floatArray; + return getFloatArrayValue(literal); + case DOUBLE_ARRAY_VALUE: + return getDoubleArrayValue(literal); + case STRING_ARRAY_VALUE: + return getStringArrayValue(literal); + default: + throw new IllegalStateException("Unsupported field type: " + type); + } + } + + private static int[] getIntArrayValue(Literal literal) { + List<Integer> intList = literal.getIntArrayValue(); + int numInts = intList.size(); + int[] intArray = new int[numInts]; + for (int i = 0; i < numInts; i++) { + intArray[i] = intList.get(i); + } + return intArray; Review Comment: Good point. I didn't move it to `ArrayListUtils` because of the special handling for float array (we use int array to send float array), but expose these methods as util and simplified `LiteralContext` -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org