npawar commented on a change in pull request #5238: Evaluate schema transform 
expressions during ingestion
URL: https://github.com/apache/incubator-pinot/pull/5238#discussion_r408306855
 
 

 ##########
 File path: 
pinot-plugins/pinot-input-format/pinot-avro-base/src/main/java/org/apache/pinot/plugin/inputformat/avro/AvroUtils.java
 ##########
 @@ -305,46 +301,23 @@ public static boolean isSingleValueField(Field field) {
     }
   }
 
-  @SuppressWarnings("unchecked")
-  public static void extractField(FieldSpec fieldSpec, GenericRecord from, 
GenericRow to) {
-    String fieldName = fieldSpec.getName();
-
-    // Handle the Map type
-    if (fieldName.endsWith(MAP_KEY_COLUMN_SUFFIX)) {
-      String avroFieldName = fieldName.substring(0, fieldName.length() - 
MAP_KEY_COLUMN_SUFFIX.length());
-      Map map = (Map) from.get(avroFieldName);
-      if (map != null) {
-        // Sort the keys so that the order is deterministic
-        TreeSet sortedKeys = new TreeSet(map.keySet());
-        to.putField(fieldName, RecordReaderUtils.convert(fieldSpec, 
sortedKeys));
-        return;
-      }
-    } else if (fieldName.endsWith(MAP_VALUE_COLUMN_SUFFIX)) {
-      String avroFieldName = fieldName.substring(0, fieldName.length() - 
MAP_VALUE_COLUMN_SUFFIX.length());
-      Map map = (Map) from.get(avroFieldName);
-      if (map != null) {
-        // Sort the keys so that the order is deterministic
-        TreeMap sortedMap = new TreeMap<>(map);
-        to.putField(fieldName, RecordReaderUtils.convert(fieldSpec, 
sortedMap.values()));
-        return;
-      }
-    }
-    to.putField(fieldName, RecordReaderUtils.convert(fieldSpec, 
convert(fieldSpec, from.get(fieldName))));
-  }
-
   /**
-   * Converts the value based on the given field spec.
+   * Converts the value to a single-valued value or a multi-valued value
    */
-  public static Object convert(FieldSpec fieldSpec, @Nullable Object value) {
-    if (fieldSpec.isSingleValueField()) {
-      return handleSingleValue(value);
+  public static Object convert(Object value) {
+    Object convertedValue;
+    if (value instanceof Collection) {
 
 Review comment:
   In avro, it cannot be

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to