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);
}
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);
}
Aggregations