liujinhui1994 commented on a change in pull request #2666:
URL: https://github.com/apache/hudi/pull/2666#discussion_r606100489



##########
File path: 
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieMergeHandle.java
##########
@@ -123,6 +127,22 @@ public HoodieMergeHandle(HoodieWriteConfig config, String 
instantTime, HoodieTab
     init(fileId, this.partitionPath, dataFileToBeMerged);
   }
 
+  protected static Pair<Schema, Schema> 
getWriterSchemaIncludingAndExcludingMetadataPair(HoodieWriteConfig config, 
HoodieTable hoodieTable) {
+    Schema originalSchema = new Schema.Parser().parse(config.getSchema());
+    Schema hoodieSchema = HoodieAvroUtils.addMetadataFields(originalSchema);
+    boolean updatePartialFields = config.updatePartialFields();
+    if (updatePartialFields) {
+      try {
+        TableSchemaResolver resolver = new 
TableSchemaResolver(hoodieTable.getMetaClient());
+        Schema lastSchema = resolver.getTableAvroSchema();
+        config.setLastSchema(lastSchema.toString());

Review comment:
       > lastSchema could be null if this is first commit or last commit is an 
operation which does not inject schema in commit metadata. Can we check if not 
null and then set the last schema. If not, .toString() could throw 
NullPointerException.
   
   ok




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to