danny0405 commented on code in PR #11802:
URL: https://github.com/apache/hudi/pull/11802#discussion_r1724148346


##########
hudi-client/hudi-spark-client/src/main/scala/org/apache/hudi/AvroConversionUtils.scala:
##########
@@ -230,12 +230,23 @@ object AvroConversionUtils {
   private def resolveUnion(schema: Schema, dataType: DataType): (Schema, 
Boolean) = {
     val innerFields = schema.getTypes.asScala
     val containsNullSchema = 
innerFields.foldLeft(false)((nullFieldEncountered, schema) => 
nullFieldEncountered | schema.getType == Schema.Type.NULL)
-    (if (containsNullSchema) {
-      Schema.createUnion((List(Schema.create(Schema.Type.NULL)) ++ 
innerFields.filter(innerSchema => !(innerSchema.getType == Schema.Type.NULL))
-        .map(innerSchema => getAvroSchemaWithDefaults(innerSchema, 
dataType))).asJava)
-    } else {
-      Schema.createUnion(schema.getTypes.asScala.map(innerSchema => 
getAvroSchemaWithDefaults(innerSchema, dataType)).asJava)
-    }, containsNullSchema)
+    dataType match {

Review Comment:
   Is this change Spark specific?



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