danny0405 commented on code in PR #12313:
URL: https://github.com/apache/hudi/pull/12313#discussion_r1853160123
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -1311,6 +1435,53 @@ public static
List<HoodieColumnRangeMetadata<Comparable>> getLogFileColumnRangeM
return Collections.emptyList();
}
+ @VisibleForTesting
+ public static Set<String> getDeletedRecordKeys(String filePath,
HoodieTableMetaClient datasetMetaClient,
+ Option<Schema>
writerSchemaOpt, int maxBufferSize,
+ String latestCommitTimestamp)
throws IOException {
+ if (writerSchemaOpt.isPresent()) {
+ // read log file records without merging
+ List<String> deletedKeys = new ArrayList<>();
+ HoodieUnMergedLogRecordScanner scanner =
HoodieUnMergedLogRecordScanner.newBuilder()
+ .withStorage(datasetMetaClient.getStorage())
+ .withBasePath(datasetMetaClient.getBasePath())
+ .withLogFilePaths(Collections.singletonList(filePath))
+ .withBufferSize(maxBufferSize)
+ .withLatestInstantTime(latestCommitTimestamp)
+ .withReaderSchema(writerSchemaOpt.get())
+ .withTableMetaClient(datasetMetaClient)
+ .withLogRecordScannerCallbackForDeletedKeys(deletedKey ->
deletedKeys.add(deletedKey.getRecordKey()))
+ .build();
+ scanner.scan();
+ return deletedKeys.stream().collect(Collectors.toSet());
Review Comment:
Why not just initialize the `deletedKeys` as a set.
--
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]