the-other-tim-brown commented on code in PR #17573:
URL: https://github.com/apache/hudi/pull/17573#discussion_r2623647223


##########
hudi-client/hudi-spark-client/src/main/scala/org/apache/spark/sql/avro/HoodieSparkSchemaConverters.scala:
##########
@@ -102,7 +102,14 @@ object HoodieSparkSchemaConverters {
           val fields = st.map { f =>
             val fieldSchema = toHoodieType(f.dataType, f.nullable, f.name, 
childNameSpace)
             val doc = f.getComment.orNull
-            HoodieSchemaField.of(f.name, fieldSchema, doc)
+            // Match existing Avro SchemaConverters behavior: use NULL_VALUE 
for nullable unions
+            // to avoid serializing "default":null in JSON representation
+            val defaultVal = if (fieldSchema.isNullable) {
+              HoodieJsonProperties.NULL_VALUE
+            } else {
+              null
+            }
+            HoodieSchemaField.of(f.name, fieldSchema, doc, defaultVal)
           }

Review Comment:
   On line 190 there is a bug is this code where the comment is added even if 
the doc string is empty which deviates from the avro path. That is causing some 
of the failures in CI



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