jonvex commented on code in PR #12430:
URL: https://github.com/apache/hudi/pull/12430#discussion_r1894115459


##########
hudi-common/src/test/java/org/apache/hudi/common/table/read/TestHoodieFileGroupReaderBase.java:
##########
@@ -157,6 +168,65 @@ public void 
testReadLogFilesOnlyInMergeOnReadTable(RecordMergeMode recordMergeMo
     }
   }
 
+  @ParameterizedTest
+  @EnumSource(value = ExternalSpillableMap.DiskMapType.class)
+  public void testSpillableMapUsage(ExternalSpillableMap.DiskMapType 
diskMapType) throws Exception {
+    Map<String, String> writeConfigs = new 
HashMap<>(getCommonConfigs(RecordMergeMode.COMMIT_TIME_ORDERING));
+    Option<Schema.Type> orderingFieldType = Option.of(Schema.Type.STRING);
+    try (HoodieTestDataGenerator dataGen = new 
HoodieTestDataGenerator(0xDEEF)) {
+      commitToTable(dataGen.generateInserts("001", 100), INSERT.value(), 
writeConfigs);
+      String baseMapPath = Files.createTempDirectory(null).toString();
+      HoodieTableMetaClient metaClient = 
HoodieTestUtils.createMetaClient(getStorageConf(), getBasePath());
+      Schema avroSchema = new 
TableSchemaResolver(metaClient).getTableAvroSchema();
+      FileSlice fileSlice = getFileSliceToRead(getStorageConf(), 
getBasePath(), metaClient, dataGen.getPartitionPaths(), true, 0);
+      List<T> records = readRecordsFromFileGroup(getStorageConf(), 
getBasePath(), metaClient,  fileSlice,
+          avroSchema, RecordMergeMode.COMMIT_TIME_ORDERING, false);
+      HoodieReaderContext<T> readerContext = 
getHoodieReaderContext(getBasePath(), avroSchema, getStorageConf());
+      Comparable castedOrderingField = readerContext.castValue(100, 
Schema.Type.STRING);
+      for (Boolean isCompressionEnabled : new boolean[] {true, false}) {
+        try (ExternalSpillableMap<Serializable, Pair<Option<T>, Map<String, 
Object>>> spillableMap =

Review Comment:
   The cache size is set to 16L for the test so it spills after the first key



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