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


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/commmon/model/HoodieSparkRecord.java:
##########
@@ -118,76 +120,80 @@ public HoodieRecordType getRecordType() {
   }
 
   @Override
-  public Object getRecordColumnValues(Schema recordSchema, String[] columns, 
boolean consistentLogicalTimestampEnabled) {
-    return HoodieSparkRecordUtils.getRecordColumnValues(data, columns, 
getStructType(), consistentLogicalTimestampEnabled);
+  public ComparableList getComparableColumnValues(Schema recordSchema, 
String[] columns, boolean consistentLogicalTimestampEnabled) {
+    StructType structType = 
HoodieInternalRowUtils.getCachedSchema(recordSchema);
+    return HoodieSparkRecordUtils.getRecordColumnValues(data, columns, 
structType, consistentLogicalTimestampEnabled);
   }
 
   @Override
-  public HoodieRecord mergeWith(HoodieRecord other, Schema targetSchema) 
throws IOException {
-    StructType otherStructType = ((HoodieSparkRecord) other).getStructType();
-    StructType writerStructType = 
HoodieInternalRowUtils.getCachedSchema(targetSchema);
-    InternalRow mergeRow = HoodieInternalRowUtils.stitchRecords(data, 
getStructType(), (InternalRow) other.getData(), otherStructType, 
writerStructType);
-    return new HoodieSparkRecord(getKey(), mergeRow, writerStructType, 
getOperation());
+  public HoodieRecord joinWith(HoodieRecord other, Schema targetSchema) throws 
IOException {
+    StructType targetStructType = 
HoodieInternalRowUtils.getCachedSchema(targetSchema);
+    InternalRow mergeRow = new JoinedRow(data, (InternalRow) other.getData());
+    return new HoodieSparkRecord(getKey(), mergeRow, targetStructType, 
getOperation());
   }
 
   @Override
   public HoodieRecord rewriteRecord(Schema recordSchema, Properties props, 
Schema targetSchema) throws IOException {
+    StructType structType = 
HoodieInternalRowUtils.getCachedSchema(recordSchema);
     StructType targetStructType = 
HoodieInternalRowUtils.getCachedSchema(targetSchema);
     UTF8String[] metaFields = extractMetaField(targetStructType);

Review Comment:
   Sorry, I don't quite understand what you mean. 
   I want to add meta fields in the current record. The following is what I do.
   1. Extract the meta fields from the targetSchema, which we want to add to 
the current record. 
   2. Because the unsafeRow is immutable, in order to avoid being converted to 
a MutableInternalRow, we need to use the HoodieInternalRow to wrap the current 
unsafeRow+meta fields. If current record has meta fields, wrapping is also 
effective. Because we could change them later. 



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