KKcorps commented on code in PR #14547:
URL: https://github.com/apache/pinot/pull/14547#discussion_r1867101992


##########
pinot-plugins/pinot-input-format/pinot-parquet/src/main/java/org/apache/pinot/plugin/inputformat/parquet/ParquetNativeRecordExtractor.java:
##########
@@ -209,79 +207,26 @@ public static long convertInt96ToLong(byte[] int96Bytes) {
   }
 
   public Object[] extractList(Group group) {
-    int repFieldCount = group.getType().getFieldCount();
-    if (repFieldCount < 1) {
-      return null;
+    int numValues = group.getType().getFieldCount();
+    Object[] array = new Object[numValues];
+    for (int i = 0; i < numValues; i++) {
+      array[i] = extractValue(group, i);
     }
-    Object[] list = new Object[repFieldCount];
-    for (int repFieldIdx = 0; repFieldIdx < repFieldCount; repFieldIdx++) {
-      list[repFieldIdx] = extractValue(group, repFieldIdx);
+    if (numValues == 1 && array[0] == null) {
+      return new Object[0];
     }
-    if (repFieldCount == 1 && list[0] == null) {
-      return null;
+    if (numValues == 1 && array[0] instanceof Object[]) {
+      return (Object[]) array[0];
     }
-    if (repFieldCount == 1 && list[0].getClass().isArray()) {
-      return (Object[]) list[0];
-    }
-    return list;
+    return array;
   }
 
   public Map<String, Object> extractMap(Group group) {
-    final int repFieldCount = group.getType().getFieldCount();
-    if (repFieldCount < 1) {
-      return null;
-    }
-    Map<String, Object> resultMap = new HashMap<>();
-    for (int repFieldIdx = 0; repFieldIdx < repFieldCount; repFieldIdx++) {
-      Object value = extractValue(group, repFieldIdx);
-      resultMap.put(group.getType().getType(repFieldIdx).getName(), value);
-    }
-    return resultMap;
-  }
-
-  @Override
-  public Object convertMap(Object value) {
-    Map<Object, Object> map = (Map) value;
-    if (map.isEmpty()) {
-      return null;
-    }
-    Map<Object, Object> convertedMap = new HashMap<>();
-    for (Map.Entry<Object, Object> entry : map.entrySet()) {
-      Object mapKey = entry.getKey();
-      Object mapValue = entry.getValue();
-      if (mapKey != null) {
-        Object convertedMapValue = null;
-        if (mapValue != null) {
-          convertedMapValue = convert(mapValue);
-        }
-        convertedMap.put(convertSingleValue(entry.getKey()), 
convertedMapValue);
-      }
-    }
-    if (convertedMap.isEmpty()) {
-      return null;
-    }
-    return convertedMap;
-  }
-
-  @Override
-  public boolean isMultiValue(Object value) {
-    if (super.isMultiValue(value)) {
-      return true;
-    }
-    if (value instanceof byte[]) {
-      return false;
-    }
-    return value.getClass().isArray();
-  }
-
-  @Nullable
-  @Override
-  protected Object convertMultiValue(Object value) {
-    if (value instanceof Collection) {
-      return super.convertMultiValue(value);
+    int numValues = group.getType().getFieldCount();
+    Map<String, Object> map = Maps.newHashMapWithExpectedSize(numValues);
+    for (int i = 0; i < numValues; i++) {
+      map.put(group.getType().getType(i).getName(), extractValue(group, i));

Review Comment:
   Ohh, I wasn't aware we used the same logic before. However, 
getType().getType() fails for primitive types so there needs to be check on 
that. we can tackle that seperately 



-- 
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

Reply via email to