rmahindra123 commented on a change in pull request #3128:
URL: https://github.com/apache/hudi/pull/3128#discussion_r667259394



##########
File path: 
hudi-common/src/test/java/org/apache/hudi/common/util/collection/TestBitCaskDiskMap.java
##########
@@ -66,27 +68,33 @@ public void setup() {
     initPath();
   }
 
-  @Test
-  public void testSimpleInsert() throws IOException, URISyntaxException {
-    BitCaskDiskMap records = new BitCaskDiskMap<>(basePath);
+  @ParameterizedTest
+  @ValueSource(booleans = {false, true})
+  public void testSimpleInsert(boolean isCompressionEnabled) throws 
IOException, URISyntaxException {
+    BitCaskDiskMap records = new BitCaskDiskMap<>(basePath, 
isCompressionEnabled);
     List<IndexedRecord> iRecords = SchemaTestUtil.generateHoodieTestRecords(0, 
100);
-    ((GenericRecord) 
iRecords.get(0)).get(HoodieRecord.COMMIT_TIME_METADATA_FIELD).toString();
     List<String> recordKeys = SpillableMapTestUtils.upsertRecords(iRecords, 
records);
 
+    Map<String, IndexedRecord> originalRecords = iRecords.stream()
+        .collect(Collectors.toMap(k -> ((GenericRecord) 
k).get(HoodieRecord.RECORD_KEY_METADATA_FIELD).toString(), v -> v));
+
     // make sure records have spilled to disk
     assertTrue(records.sizeOfFileOnDiskInBytes() > 0);
     Iterator<HoodieRecord<? extends HoodieRecordPayload>> itr = 
records.iterator();
-    List<HoodieRecord> oRecords = new ArrayList<>();
     while (itr.hasNext()) {
       HoodieRecord<? extends HoodieRecordPayload> rec = itr.next();
-      oRecords.add(rec);
       assert recordKeys.contains(rec.getRecordKey());
+      IndexedRecord originalRecord = originalRecords.get(rec.getRecordKey());
+      HoodieAvroPayload payload = (HoodieAvroPayload) rec.getData();
+      Option<IndexedRecord> value = 
payload.getInsertValue(HoodieAvroUtils.addMetadataFields(getSimpleSchema()));
+      assertEquals(originalRecord, value.get());

Review comment:
       Added testing for value, that should test compression/decompression




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