voonhous commented on code in PR #17581:
URL: https://github.com/apache/hudi/pull/17581#discussion_r2625439987


##########
hudi-hadoop-mr/src/main/java/org/apache/hudi/hadoop/utils/HiveAvroSerializer.java:
##########
@@ -419,20 +425,20 @@ private Object serializeUnion(UnionTypeInfo typeInfo, 
UnionObjectInspector field
         schema.getTypes().get(tag));
   }
 
-  private Object serializeList(ListTypeInfo typeInfo, ListObjectInspector 
fieldOI, Object structFieldData, Schema schema) throws HoodieException {
+  private Object serializeList(ListTypeInfo typeInfo, ListObjectInspector 
fieldOI, Object structFieldData, HoodieSchema schema) throws HoodieException {
     List<?> list = fieldOI.getList(structFieldData);
-    List<Object> deserialized = new GenericData.Array<Object>(list.size(), 
schema);
+    List<Object> deserialized = new GenericData.Array<>(list.size(), 
schema.toAvroSchema());
 
     TypeInfo listElementTypeInfo = typeInfo.getListElementTypeInfo();
     ObjectInspector listElementObjectInspector = 
fieldOI.getListElementObjectInspector();
     // NOTE: We have to resolve nullable schema, since Avro permits array 
elements
     //       to be null
-    Schema arrayNestedType = 
AvroSchemaUtils.getNonNullTypeFromUnion(schema.getElementType());
-    Schema elementType;
+    HoodieSchema arrayNestedType = schema.getElementType().getNonNullType();
+    HoodieSchema elementType;
     if (listElementObjectInspector.getCategory() == 
ObjectInspector.Category.PRIMITIVE) {
       elementType = arrayNestedType;
     } else {
-      elementType = arrayNestedType.getField("element") == null ? 
arrayNestedType : arrayNestedType.getField("element").schema();
+      elementType = arrayNestedType.getField("element").isEmpty() ? 
arrayNestedType : arrayNestedType.getField("element").get().schema();

Review Comment:
   Done



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to