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


##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/payload/ExpressionPayload.scala:
##########
@@ -214,11 +214,7 @@ class ExpressionPayload(record: GenericRecord,
    * Init the table schema.
    */
   private def initWriteSchemaIfNeed(properties: Properties): Unit = {
-    if (writeSchema == null) {
-      
ValidationUtils.checkArgument(properties.containsKey(HoodieWriteConfig.WRITE_SCHEMA.key),
-        s"Missing ${HoodieWriteConfig.WRITE_SCHEMA.key}")
-      writeSchema = new 
Schema.Parser().parse(properties.getProperty(HoodieWriteConfig.WRITE_SCHEMA.key))
-    }
+    writeSchema = setWriteSchema(properties)
   }

Review Comment:
   Seems you want to make the schema object as singleton for different payload 
instance, then the null check may still makes sense here. I mean the decision 
`if (writeSchema == null)` should be kept.



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