Search in sources :

Example 1 with OrcIndex

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;
}
Also used : OrcProto(org.apache.orc.OrcProto) ArrayList(java.util.ArrayList) OrcIndex(org.apache.orc.impl.OrcIndex) OrcBatchKey(org.apache.hadoop.hive.ql.io.orc.encoded.OrcBatchKey) StripeInformation(org.apache.orc.StripeInformation) OrcStripeMetadata(org.apache.hadoop.hive.llap.io.metadata.OrcStripeMetadata)

Example 2 with OrcIndex

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;
}
Also used : OrcProto(org.apache.orc.OrcProto) OrcIndex(org.apache.orc.impl.OrcIndex) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 3 with OrcIndex

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);
}
Also used : RowIndex(org.apache.orc.OrcProto.RowIndex) CalendarKind(org.apache.orc.OrcProto.CalendarKind) CompressionKind(org.apache.orc.CompressionKind) BloomFilterIndex(org.apache.orc.OrcProto.BloomFilterIndex) OrcIndex(org.apache.orc.impl.OrcIndex) Stream(org.apache.orc.OrcProto.Stream) InStream(org.apache.orc.impl.InStream) OrcBatchKey(org.apache.hadoop.hive.ql.io.orc.encoded.OrcBatchKey) OrcStripeMetadata(org.apache.hadoop.hive.llap.io.metadata.OrcStripeMetadata)

Aggregations

OrcIndex (org.apache.orc.impl.OrcIndex)3 OrcStripeMetadata (org.apache.hadoop.hive.llap.io.metadata.OrcStripeMetadata)2 OrcBatchKey (org.apache.hadoop.hive.ql.io.orc.encoded.OrcBatchKey)2 OrcProto (org.apache.orc.OrcProto)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ArrayList (java.util.ArrayList)1 CompressionKind (org.apache.orc.CompressionKind)1 BloomFilterIndex (org.apache.orc.OrcProto.BloomFilterIndex)1 CalendarKind (org.apache.orc.OrcProto.CalendarKind)1 RowIndex (org.apache.orc.OrcProto.RowIndex)1 Stream (org.apache.orc.OrcProto.Stream)1 StripeInformation (org.apache.orc.StripeInformation)1 InStream (org.apache.orc.impl.InStream)1