Search in sources :

Example 6 with OrcStripeMetadata

use of org.apache.hadoop.hive.llap.io.metadata.OrcStripeMetadata in project hive by apache.

the class TestOrcMetadataCache method testGetPut.

@Test
public void testGetPut() throws Exception {
    DummyMemoryManager mm = new DummyMemoryManager();
    DummyCachePolicy cp = new DummyCachePolicy();
    OrcMetadataCache cache = new OrcMetadataCache(mm, cp, false);
    OrcFileMetadata ofm1 = OrcFileMetadata.createDummy(1), ofm2 = OrcFileMetadata.createDummy(2);
    assertSame(ofm1, cache.putFileMetadata(ofm1));
    assertEquals(1, mm.allocs);
    cp.verifyEquals(1);
    assertSame(ofm2, cache.putFileMetadata(ofm2));
    assertEquals(2, mm.allocs);
    cp.verifyEquals(2);
    assertSame(ofm1, cache.getFileMetadata(1));
    assertSame(ofm2, cache.getFileMetadata(2));
    cp.verifyEquals(4);
    OrcFileMetadata ofm3 = OrcFileMetadata.createDummy(1);
    assertSame(ofm1, cache.putFileMetadata(ofm3));
    assertEquals(2, mm.allocs);
    cp.verifyEquals(5);
    assertSame(ofm1, cache.getFileMetadata(1));
    cp.verifyEquals(6);
    OrcStripeMetadata osm1 = OrcStripeMetadata.createDummy(1), osm2 = OrcStripeMetadata.createDummy(2);
    assertSame(osm1, cache.putStripeMetadata(osm1));
    assertEquals(3, mm.allocs);
    assertSame(osm2, cache.putStripeMetadata(osm2));
    assertEquals(4, mm.allocs);
    assertSame(osm1, cache.getStripeMetadata(osm1.getKey()));
    assertSame(osm2, cache.getStripeMetadata(osm2.getKey()));
    OrcStripeMetadata osm3 = OrcStripeMetadata.createDummy(1);
    assertSame(osm1, cache.putStripeMetadata(osm3));
    assertEquals(4, mm.allocs);
    assertSame(osm1, cache.getStripeMetadata(osm3.getKey()));
    cp.verifyEquals(12);
}
Also used : OrcFileMetadata(org.apache.hadoop.hive.llap.io.metadata.OrcFileMetadata) OrcMetadataCache(org.apache.hadoop.hive.llap.io.metadata.OrcMetadataCache) OrcStripeMetadata(org.apache.hadoop.hive.llap.io.metadata.OrcStripeMetadata) Test(org.junit.Test)

Example 7 with OrcStripeMetadata

use of org.apache.hadoop.hive.llap.io.metadata.OrcStripeMetadata 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

OrcStripeMetadata (org.apache.hadoop.hive.llap.io.metadata.OrcStripeMetadata)7 StripeInformation (org.apache.orc.StripeInformation)5 OrcBatchKey (org.apache.hadoop.hive.ql.io.orc.encoded.OrcBatchKey)4 OrcFileMetadata (org.apache.hadoop.hive.llap.io.metadata.OrcFileMetadata)2 RecordReaderImpl (org.apache.hadoop.hive.ql.io.orc.RecordReaderImpl)2 OrcProto (org.apache.orc.OrcProto)2 OrcIndex (org.apache.orc.impl.OrcIndex)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 ObjectEstimator (org.apache.hadoop.hive.llap.IncrementalObjectSizeEstimator.ObjectEstimator)1 OrcMetadataCache (org.apache.hadoop.hive.llap.io.metadata.OrcMetadataCache)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 InStream (org.apache.orc.impl.InStream)1