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


##########
hudi-client/hudi-flink-client/src/main/java/org/apache/hudi/io/storage/row/HoodieRowDataCreateHandle.java:
##########
@@ -143,13 +145,17 @@ public void write(String recordKey, String partitionPath, 
RowData record) throws
       String commitInstant;
       RowData rowData;
       if (!skipMetadataWrite) {
-        seqId = preserveHoodieMetadata
-            ? 
record.getString(HoodieRecord.COMMIT_SEQNO_METADATA_FIELD_ORD).toString()
-            : HoodieRecord.generateSequenceId(instantTime, taskPartitionId, 
SEQGEN.getAndIncrement());
-        commitInstant = preserveHoodieMetadata
-            ? 
record.getString(HoodieRecord.COMMIT_TIME_METADATA_FIELD_ORD).toString()
-            : instantTime;
-        rowData = HoodieRowDataCreation.create(commitInstant, seqId, 
recordKey, partitionPath, path.getName(),
+        commitInstant = populateIndividualMetaFields[0]
+            ? (preserveHoodieMetadata ? 
record.getString(HoodieRecord.COMMIT_TIME_METADATA_FIELD_ORD).toString() : 
instantTime)
+            : null;
+        seqId = populateIndividualMetaFields[1]
+            ? (preserveHoodieMetadata ? 
record.getString(HoodieRecord.COMMIT_SEQNO_METADATA_FIELD_ORD).toString()
+                : HoodieRecord.generateSequenceId(instantTime, 
taskPartitionId, SEQGEN.getAndIncrement()))
+            : null;
+        String effectiveRecordKey = populateIndividualMetaFields[2] ? 
recordKey : null;
+        String effectivePartitionPath = populateIndividualMetaFields[3] ? 
partitionPath : null;
+        String effectiveFileName = populateIndividualMetaFields[4] ? 
path.getName() : null;
+        rowData = HoodieRowDataCreation.create(commitInstant, seqId, 
effectiveRecordKey, effectivePartitionPath, effectiveFileName,

Review Comment:
   what about the other write paths like COW merge and MOR compaction, they 
should also follow the metadata fields population?



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