You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/09/08 20:38:07 UTC

[GitHub] [pinot] Jackie-Jiang commented on a change in pull request #7402: Faster association between Java Class and PinotDataType

Jackie-Jiang commented on a change in pull request #7402:
URL: https://github.com/apache/pinot/pull/7402#discussion_r704755085



##########
File path: pinot-common/src/main/java/org/apache/pinot/common/utils/PinotDataType.java
##########
@@ -1119,13 +1090,68 @@ public PinotDataType getSingleValueType() {
   }
 
   public static PinotDataType getSingleValueType(Class<?> cls) {
-    PinotDataType pdt = SINGLE_VALUE_TYPE_MAP.get(cls);
-    return (pdt != null) ? pdt : OBJECT;
+    if (cls == String.class) {
+      return STRING;
+    }
+    if (cls == Float.class) {
+      return FLOAT;
+    }
+    if (cls == Double.class) {
+      return DOUBLE;
+    }
+    if (cls == Timestamp.class) {
+      return TIMESTAMP;
+    }
+    if (cls == Boolean.class) {
+      return BOOLEAN;
+    }
+    if (cls == Short.class) {
+      return SHORT;
+    }
+    if (cls == Integer.class) {
+      return INTEGER;
+    }
+    if (cls == Long.class) {
+      return LONG;
+    }
+    if (cls == byte[].class) {
+      return BYTES;
+    }
+    if (cls == Byte.class) {
+      return BYTE;
+    }
+    if (cls == Character.class) {
+      return CHARACTER;
+    }
+    return OBJECT;
   }
 
   public static PinotDataType getMultiValueType(Class<?> cls) {
-    PinotDataType pdt = MULTI_VALUE_TYPE_MAP.get(cls);
-    return (pdt != null) ? pdt : OBJECT_ARRAY;
+    if (cls == String.class) {

Review comment:
       Similarly, `INT_ARRAY`, `LONG_ARRAY`, `FLOAT_ARRAY`, `DOUBLE_ARRAY`, `STRING_ARRAY`, `BYTE_ARRAY`, `CHARACTER_ARRAY`, `SHORT_ARRAY`, `OBJECT_ARRAY`

##########
File path: pinot-common/src/main/java/org/apache/pinot/common/utils/PinotDataType.java
##########
@@ -1119,13 +1090,68 @@ public PinotDataType getSingleValueType() {
   }
 
   public static PinotDataType getSingleValueType(Class<?> cls) {
-    PinotDataType pdt = SINGLE_VALUE_TYPE_MAP.get(cls);
-    return (pdt != null) ? pdt : OBJECT;
+    if (cls == String.class) {

Review comment:
       Let's keep the supported storage type in the front because they are usually more commonly used, and more readable
   `INT, LONG, FLOAT, DOUBLE, STRING, BYTES, BOOLEAN, TIMESTAMP, BYTE, CHARACTER, SHORT, OBJECT`




-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org