wzx140 commented on code in PR #7003:
URL: https://github.com/apache/hudi/pull/7003#discussion_r1029482992


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/commmon/model/HoodieSparkRecord.java:
##########
@@ -183,28 +182,27 @@ public HoodieRecord rewriteRecord(Schema recordSchema, 
Properties props, Schema
     StructType structType = 
HoodieInternalRowUtils.getCachedSchema(recordSchema);
     StructType targetStructType = 
HoodieInternalRowUtils.getCachedSchema(targetSchema);
 
-    boolean containMetaFields = hasMetaFields(structType);
+    boolean containMetaFields = hasMetaFields(targetStructType);
     UTF8String[] metaFields = tryExtractMetaFields(data, structType);
+    InternalRow rewriteRecord = 
HoodieInternalRowUtils.rewriteRecord(this.data, structType, targetStructType);
+    UnsafeRow unsafeRow = 
HoodieInternalRowUtils.getCachedUnsafeProjection(targetStructType, 
targetStructType).apply(rewriteRecord);
+    InternalRow finalRow = copy ? unsafeRow.copy() : unsafeRow;

Review Comment:
   I think operation on record should not change the copy state. When the 
record is copied, it means the record need to be copied. So we should do copy 
on the rewrited record too. Does this make sence?



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