nsivabalan commented on code in PR #9114:
URL: https://github.com/apache/hudi/pull/9114#discussion_r1251129461


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -1159,10 +1161,30 @@ protected boolean 
validateTimelineBeforeSchedulingCompaction(Option<String> inFl
    * @param writeStatuses {@code WriteStatus} from the write operation
    */
   private HoodieData<HoodieRecord> 
getRecordIndexUpdates(HoodieData<WriteStatus> writeStatuses) {
-    return writeStatuses.flatMap(writeStatus -> {
-      List<HoodieRecord> recordList = new LinkedList<>();
-      for (HoodieRecordDelegate recordDelegate : 
writeStatus.getWrittenRecordDelegates()) {
-        if (!writeStatus.isErrored(recordDelegate.getHoodieKey())) {
+    // 1. List<HoodieRecordDelegate>
+    // 2. Reduce by key: accept keys only when new location is not
+    return writeStatuses.map(writeStatus -> 
writeStatus.getWrittenRecordDelegates().stream().map(recordDelegate -> 
Pair.of(writeStatus, recordDelegate)))
+        .flatMapToPair(Stream::iterator)

Review Comment:
   Lets do something like this. might be simpler
   
   HD<WriteStatus> 
   
   HD<WS> map to HpairD<String(RK), HRD> 
   
   reduceByKey(combine) -> record (only one record for one record key)
   
   .values() should give us the final HD<HRD> 
   
   



-- 
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-unsubscr...@hudi.apache.org

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

Reply via email to