lokeshj1703 commented on code in PR #13449:
URL: https://github.com/apache/hudi/pull/13449#discussion_r2163643135


##########
hudi-spark-datasource/hudi-spark/src/test/java/org/apache/hudi/io/TestAppendHandle.java:
##########
@@ -82,15 +109,26 @@ public void testAppendHandleRLIStats(boolean 
populateMetaFields) {
     handle.close();
 
     assertEquals(records.size(), writeStatus.getTotalRecords());
+    assertEquals(numDeletes, writeStatus.getStat().getNumDeletes());
     assertEquals(0, writeStatus.getTotalErrorRecords());
     // validate write status has all record delegates
-    if (populateMetaFields) {
-      assertEquals(records.size(), 
writeStatus.getWrittenRecordDelegates().size());
-      for (HoodieRecordDelegate recordDelegate : 
writeStatus.getWrittenRecordDelegates()) {
+    assertEquals(records.size(), 
writeStatus.getIndexStats().getWrittenRecordDelegates().size());
+    int numDeletedRecordDelegates = 0;
+    for (HoodieRecordDelegate recordDelegate : 
writeStatus.getIndexStats().getWrittenRecordDelegates()) {
+      if (!recordDelegate.getNewLocation().isPresent()) {
+        numDeletedRecordDelegates++;
+      } else {
         assertTrue(recordDelegate.getNewLocation().isPresent());
         assertEquals(fileId, 
recordDelegate.getNewLocation().get().getFileId());
         assertEquals(instantTime, 
recordDelegate.getNewLocation().get().getInstantTime());
       }
     }
+    assertEquals(numDeletes, numDeletedRecordDelegates);
+
+    // validate SI stats
+    assertEquals(1, 
writeStatus.getIndexStats().getSecondaryIndexStats().size());
+    // secondary index records size is same twice the number of updates and 
number of deletes
+    // Two records for every update - delete old record and insert new record
+    assertEquals(2 * numUpdates + numDeletes, 
writeStatus.getIndexStats().getSecondaryIndexStats().values().stream().findFirst().get().size());

Review Comment:
   Addressed



##########
hudi-common/src/main/java/org/apache/hudi/common/table/view/AbstractTableFileSystemView.java:
##########
@@ -1060,6 +1060,20 @@ public final Stream<FileSlice> 
getLatestMergedFileSlicesBeforeOrOn(String partit
     }
   }
 
+  @Override
+  public final Option<FileSlice> getLatestMergedFileSliceBeforeOrOn(String 
partitionStr, String maxInstantTime, String fileId) {

Review Comment:
   Added them



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