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


##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -759,6 +769,131 @@ public static HoodieData<HoodieRecord> 
convertMetadataToColumnStatsRecords(Hoodi
         });
   }
 
+  static HoodieData<HoodieRecord> 
convertMetadataToRecordIndexRecords(HoodieEngineContext engineContext,
+                                                                      
HoodieCommitMetadata commitMetadata,
+                                                                      
HoodieMetadataConfig metadataConfig,
+                                                                      
HoodieTableMetaClient dataTableMetaClient,
+                                                                      int 
writesFileIdEncoding,
+                                                                      String 
instantTime) {
+
+    List<HoodieWriteStat> allWriteStats = 
commitMetadata.getPartitionToWriteStats().values().stream()
+        .flatMap(Collection::stream).collect(Collectors.toList());
+
+    if (allWriteStats.isEmpty()) {
+      return engineContext.emptyHoodieData();
+    }
+
+    try {
+      int parallelism = Math.max(Math.min(allWriteStats.size(), 
metadataConfig.getRecordIndexMaxParallelism()), 1);
+      String basePath = dataTableMetaClient.getBasePath().toString();
+      // we might need to set some additional variables if we need to process 
log files.
+      boolean anyLogFilesWithDeletes = 
allWriteStats.stream().anyMatch(writeStat -> {

Review Comment:
   there are some minor differences across RLI and SI code paths.  
   
   one of them generates HoodieData<HoodieRecord>, while the SI one just 
returns a List<Strings> and 
   one of them is interested only for logs w/ deletes. 
   one of them is interested in INSERTS and DELETES, while the other is 
interested in DELETES and UPDATES. 
   
   I have avoided code duplication in BaseFileParsingUtils. here, it becomes 
little messy. Will try to take a stab at it. but not gonna be a easy one. 
   



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