manojpec commented on a change in pull request #4352:
URL: https://github.com/apache/hudi/pull/4352#discussion_r784430703
##########
File path:
hudi-common/src/main/java/org/apache/hudi/metadata/BaseTableMetadata.java
##########
@@ -146,6 +155,97 @@ protected BaseTableMetadata(HoodieEngineContext
engineContext, HoodieMetadataCon
.getAllFilesInPartitions(partitions);
}
+ @Override
+ public Option<ByteBuffer> getBloomFilter(final PartitionIndexID
partitionIndexID, final FileIndexID fileIndexID)
+ throws HoodieMetadataException {
+ if (!isMetaIndexBloomFilterEnabled) {
+ LOG.error("Meta bloom filter index is disabled!");
+ return Option.empty();
+ }
+
+ HoodieTimer timer = new HoodieTimer().startTimer();
+ final String bloomIndexKey =
partitionIndexID.asBase64EncodedString().concat(fileIndexID.asBase64EncodedString());
+ Option<HoodieRecord<HoodieMetadataPayload>> hoodieRecord =
getRecordByKey(bloomIndexKey,
+ MetadataPartitionType.BLOOM_FILTERS.partitionPath());
+ metrics.ifPresent(m ->
m.updateMetrics(HoodieMetadataMetrics.LOOKUP_BLOOM_FILTERS_METADATA_STR,
timer.endTimer()));
+
+ if (!hoodieRecord.isPresent()) {
+ LOG.error("Meta bloom filter index: lookup failed for partition: " +
partitionIndexID.getName() + ", file: "
+ + fileIndexID.getName());
+ return Option.empty();
+ }
+
+ final Option<HoodieMetadataBloomFilter> fileBloomFilter =
hoodieRecord.get().getData().getBloomFilterMetadata();
+ if (!fileBloomFilter.isPresent()) {
+ LOG.error("Meta bloom filter index: bloom filter missing for partition:
" + partitionIndexID.getName()
+ + ", file: " + fileIndexID.getName());
+ return Option.empty();
+ }
+
+ return Option.of(fileBloomFilter.get().getBloomFilter());
+ }
+
+ @Override
+ public Map<String, ByteBuffer> getBloomFilters(final
List<Pair<PartitionIndexID, FileIndexID>> partitionFileIndexIDList)
+ throws HoodieMetadataException {
+ if (!isMetaIndexBloomFilterEnabled) {
+ LOG.error("Meta bloom filter index is disabled!");
Review comment:
Caller throws exception when he doesn't find the bloom filter for any
file. At this level we don't need to throw.
--
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]