klsince commented on a change in pull request #7402: URL: https://github.com/apache/pinot/pull/7402#discussion_r703753717
########## File path: pinot-common/src/main/java/org/apache/pinot/common/utils/PinotDataType.java ########## @@ -776,30 +777,70 @@ public String toString(Object value) { // Mapping Java class type to PinotDataType, for SV and MV value separately. // OBJECT and OBJECT_ARRAY are default type for unknown Java types. - private static final Map<Class<?>, PinotDataType> SINGLE_VALUE_TYPE_MAP = new HashMap<Class<?>, PinotDataType>() {{ - put(Boolean.class, BOOLEAN); - put(Byte.class, BYTE); - put(Character.class, CHARACTER); - put(Short.class, SHORT); - put(Integer.class, INTEGER); - put(Long.class, LONG); - put(Float.class, FLOAT); - put(Double.class, DOUBLE); - put(Timestamp.class, TIMESTAMP); - put(String.class, STRING); - put(byte[].class, BYTES); - }}; - - private static final Map<Class<?>, PinotDataType> MULTI_VALUE_TYPE_MAP = new HashMap<Class<?>, PinotDataType>() {{ - put(Byte.class, BYTE_ARRAY); - put(Character.class, CHARACTER_ARRAY); - put(Short.class, SHORT_ARRAY); - put(Integer.class, INTEGER_ARRAY); - put(Long.class, LONG_ARRAY); - put(Float.class, FLOAT_ARRAY); - put(Double.class, DOUBLE_ARRAY); - put(String.class, STRING_ARRAY); - }}; + private static final Function<Class<?>, PinotDataType> SINGLE_VALUE_TYPE_MAPPING = memoize(cls -> { Review comment: Understood. I was wondering what if simply using those if-else branches (or perhaps a switch-case block) in getSingleValueType() method, vs. using MemoizedClassFunction. -- 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