use of io.prestosql.orc.protobuf.ByteString in project hetu-core by openlookeng.
the class OrcMetadataReader method readBloomFilterIndexes.
@Override
public List<HashableBloomFilter> readBloomFilterIndexes(InputStream inputStream) throws IOException {
CodedInputStream input = CodedInputStream.newInstance(inputStream);
OrcProto.BloomFilterIndex bloomFilter = OrcProto.BloomFilterIndex.parseFrom(input);
List<OrcProto.BloomFilter> bloomFilterList = bloomFilter.getBloomFilterList();
ImmutableList.Builder<HashableBloomFilter> builder = ImmutableList.builder();
for (OrcProto.BloomFilter orcBloomFilter : bloomFilterList) {
if (orcBloomFilter.hasUtf8Bitset()) {
ByteString utf8Bitset = orcBloomFilter.getUtf8Bitset();
long[] bits = new long[utf8Bitset.size() / 8];
utf8Bitset.asReadOnlyByteBuffer().order(ByteOrder.LITTLE_ENDIAN).asLongBuffer().get(bits);
builder.add(new HashableBloomFilter(bits, orcBloomFilter.getNumHashFunctions()));
} else {
builder.add(new HashableBloomFilter(Longs.toArray(orcBloomFilter.getBitsetList()), orcBloomFilter.getNumHashFunctions()));
}
}
return builder.build();
}
Aggregations