use of org.apache.hudi.metadata.HoodieMetadataMergedLogRecordReader in project hudi by apache.
the class TestHoodieBackedMetadata method verifyMetadataMergedRecords.
/**
* Verify the metadata table in-memory merged records. Irrespective of key deduplication
* config, the in-memory merged records should always have the key field in the record
* payload fully materialized.
*
* @param metadataMetaClient - Metadata table meta client
* @param logFilePaths - Metadata table log file paths
* @param latestCommitTimestamp
* @param enableMetaFields - Enable meta fields
*/
private void verifyMetadataMergedRecords(HoodieTableMetaClient metadataMetaClient, List<String> logFilePaths, String latestCommitTimestamp, boolean enableMetaFields) {
Schema schema = HoodieAvroUtils.addMetadataFields(HoodieMetadataRecord.getClassSchema());
if (enableMetaFields) {
schema = HoodieAvroUtils.addMetadataFields(schema);
}
HoodieMetadataMergedLogRecordReader logRecordReader = HoodieMetadataMergedLogRecordReader.newBuilder().withFileSystem(metadataMetaClient.getFs()).withBasePath(metadataMetaClient.getBasePath()).withLogFilePaths(logFilePaths).withLatestInstantTime(latestCommitTimestamp).withPartition(MetadataPartitionType.FILES.getPartitionPath()).withReaderSchema(schema).withMaxMemorySizeInBytes(100000L).withBufferSize(4096).withSpillableMapBasePath(tempDir.toString()).withDiskMapType(ExternalSpillableMap.DiskMapType.BITCASK).build();
assertDoesNotThrow(() -> {
logRecordReader.scan();
}, "Metadata log records materialization failed");
for (Map.Entry<String, HoodieRecord<? extends HoodieRecordPayload>> entry : logRecordReader.getRecords().entrySet()) {
assertFalse(entry.getKey().isEmpty());
assertFalse(entry.getValue().getRecordKey().isEmpty());
assertEquals(entry.getKey(), entry.getValue().getRecordKey());
}
}
use of org.apache.hudi.metadata.HoodieMetadataMergedLogRecordReader in project hudi by apache.
the class TestHoodieBackedTableMetadata method verifyMetadataMergedRecords.
/**
* Verify the metadata table in-memory merged records. Irrespective of key deduplication
* config, the in-memory merged records should always have the key field in the record
* payload fully materialized.
*
* @param metadataMetaClient - Metadata table meta client
* @param logFilePaths - Metadata table log file paths
* @param latestCommitTimestamp - Latest commit timestamp
*/
private void verifyMetadataMergedRecords(HoodieTableMetaClient metadataMetaClient, List<String> logFilePaths, String latestCommitTimestamp) {
Schema schema = HoodieAvroUtils.addMetadataFields(HoodieMetadataRecord.getClassSchema());
HoodieMetadataMergedLogRecordReader logRecordReader = HoodieMetadataMergedLogRecordReader.newBuilder().withFileSystem(metadataMetaClient.getFs()).withBasePath(metadataMetaClient.getBasePath()).withLogFilePaths(logFilePaths).withLatestInstantTime(latestCommitTimestamp).withPartition(MetadataPartitionType.FILES.getPartitionPath()).withReaderSchema(schema).withMaxMemorySizeInBytes(100000L).withBufferSize(4096).withSpillableMapBasePath(tempDir.toString()).withDiskMapType(ExternalSpillableMap.DiskMapType.BITCASK).build();
assertDoesNotThrow(() -> {
logRecordReader.scan();
}, "Metadata log records materialization failed");
for (Map.Entry<String, HoodieRecord<? extends HoodieRecordPayload>> entry : logRecordReader.getRecords().entrySet()) {
assertFalse(entry.getKey().isEmpty());
assertFalse(entry.getValue().getRecordKey().isEmpty());
assertEquals(entry.getKey(), entry.getValue().getRecordKey());
}
}
Aggregations