You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/06/16 02:51:00 UTC
[GitHub] [hudi] danny0405 commented on a diff in pull request #5820: [HUDI-4214] improve repeat init write schema in ExpressionPayload
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org