use of org.apache.orc.impl.OrcIndex in project hive by apache.
the class OrcEncodedDataReader method readStripesMetadata.
/**
* Reads the metadata for all stripes in the file.
*/
private ArrayList<OrcStripeMetadata> readStripesMetadata(boolean[] includes, boolean[] sargColumns) throws IOException {
ArrayList<OrcStripeMetadata> result = new ArrayList<OrcStripeMetadata>(stripeRgs.length);
boolean hasFileId = this.fileKey != null;
OrcBatchKey stripeKey = hasFileId ? new OrcBatchKey(fileKey, 0, 0) : null;
for (int stripeIxMod = 0; stripeIxMod < stripeRgs.length; ++stripeIxMod) {
int stripeIx = stripeIxMod + stripeIxFrom;
stripeKey.stripeIx = stripeIx;
StripeInformation si = fileMetadata.getStripes().get(stripeIx);
OrcProto.StripeFooter footer = getStripeFooterFromCacheOrDisk(si, stripeKey);
OrcStripeMetadata osm = createOrcStripeMetadataObject(stripeIx, si, footer, includes, sargColumns);
ensureDataReader();
OrcIndex index = osm.getIndex();
stripeReader.readIndexStreams(index, si, footer.getStreamsList(), includes, sargColumns);
result.add(osm);
consumer.setStripeMetadata(osm);
}
return result;
}
use of org.apache.orc.impl.OrcIndex in project hive by apache.
the class OrcStripeMetadata method createDummy.
@VisibleForTesting
public static OrcStripeMetadata createDummy(Object id) {
OrcStripeMetadata dummy = new OrcStripeMetadata(id);
dummy.encodings.add(OrcProto.ColumnEncoding.getDefaultInstance());
dummy.streams.add(OrcProto.Stream.getDefaultInstance());
OrcProto.RowIndex ri = OrcProto.RowIndex.newBuilder().addEntry(OrcProto.RowIndexEntry.newBuilder().addPositions(1).setStatistics(OrcFileMetadata.createStatsDummy())).build();
OrcProto.BloomFilterIndex bfi = OrcProto.BloomFilterIndex.newBuilder().addBloomFilter(OrcProto.BloomFilter.newBuilder().addBitset(0)).build();
dummy.rowIndex = new OrcIndex(new OrcProto.RowIndex[] { ri }, new OrcProto.Stream.Kind[] { OrcProto.Stream.Kind.BLOOM_FILTER_UTF8 }, new OrcProto.BloomFilterIndex[] { bfi });
return dummy;
}
use of org.apache.orc.impl.OrcIndex in project hive by apache.
the class OrcEncodedDataReader method createOrcStripeMetadataObject.
private OrcStripeMetadata createOrcStripeMetadataObject(int stripeIx, StripeInformation si, OrcProto.StripeFooter footer, boolean[] includes, boolean[] sargColumns) throws IOException {
Stream.Kind[] bks = sargColumns == null ? null : new Stream.Kind[includes.length];
BloomFilterIndex[] bis = sargColumns == null ? null : new BloomFilterIndex[includes.length];
return new OrcStripeMetadata(new OrcBatchKey(fileKey, stripeIx, 0), footer, new OrcIndex(new RowIndex[includes.length], bks, bis), si);
}
Aggregations