use of org.apache.orc.impl.MemoryManagerImpl in project hive by apache.
the class TestOrcFile method testMemoryManagementV12.
@Test
public void testMemoryManagementV12() throws Exception {
OrcConf.ROWS_BETWEEN_CHECKS.setLong(conf, 100);
final long poolSize = 50_000;
ObjectInspector inspector;
synchronized (TestOrcFile.class) {
inspector = ObjectInspectorFactory.getReflectionObjectInspector(InnerStruct.class, ObjectInspectorFactory.ObjectInspectorOptions.JAVA);
}
MemoryManager memoryManager = new MemoryManagerImpl(poolSize);
// set up 10 files that all request the full size.
MemoryManager.Callback ignore = newScale -> false;
for (int f = 0; f < 9; ++f) {
memoryManager.addWriter(new Path("file-" + f), poolSize, ignore);
}
Writer writer = OrcFile.createWriter(testFilePath, OrcFile.writerOptions(conf).inspector(inspector).compress(CompressionKind.NONE).stripeSize(50000).bufferSize(100).rowIndexStride(0).memory(memoryManager).batchSize(100).version(OrcFile.Version.V_0_12));
assertEquals(0.1, ((MemoryManagerImpl) memoryManager).getAllocationScale());
for (int i = 0; i < 2500; ++i) {
writer.addRow(new InnerStruct(i * 300, Integer.toHexString(10 * i)));
}
writer.close();
Reader reader = OrcFile.createReader(testFilePath, OrcFile.readerOptions(conf).filesystem(fs));
int i = 0;
for (StripeInformation stripe : reader.getStripes()) {
i += 1;
assertTrue("stripe " + i + " is too long at " + stripe.getDataLength(), stripe.getDataLength() < 5000);
}
// with HIVE-7832, the dictionaries will be disabled after writing the first
// stripe as there are too many distinct values. Hence only 3 stripes as
// compared to 25 stripes in version 0.11 (above test case)
assertEquals(3, i);
assertEquals(2500, reader.getNumberOfRows());
reader.close();
}
use of org.apache.orc.impl.MemoryManagerImpl in project hive by apache.
the class TestOrcFile method testMemoryManagementV11.
@Test
public void testMemoryManagementV11() throws Exception {
OrcConf.ROWS_BETWEEN_CHECKS.setLong(conf, 100);
final long poolSize = 50_000;
ObjectInspector inspector;
synchronized (TestOrcFile.class) {
inspector = ObjectInspectorFactory.getReflectionObjectInspector(InnerStruct.class, ObjectInspectorFactory.ObjectInspectorOptions.JAVA);
}
MemoryManager memoryManager = new MemoryManagerImpl(poolSize);
// set up 10 files that all request the full size.
MemoryManager.Callback ignore = newScale -> false;
for (int f = 0; f < 9; ++f) {
memoryManager.addWriter(new Path("file-" + f), poolSize, ignore);
}
Writer writer = OrcFile.createWriter(testFilePath, OrcFile.writerOptions(conf).inspector(inspector).compress(CompressionKind.NONE).stripeSize(50000).bufferSize(100).rowIndexStride(0).memory(memoryManager).batchSize(100).version(OrcFile.Version.V_0_11));
assertEquals(0.1, ((MemoryManagerImpl) memoryManager).getAllocationScale());
for (int i = 0; i < 2500; ++i) {
writer.addRow(new InnerStruct(i * 300, Integer.toHexString(10 * i)));
}
writer.close();
Reader reader = OrcFile.createReader(testFilePath, OrcFile.readerOptions(conf).filesystem(fs));
int i = 0;
for (StripeInformation stripe : reader.getStripes()) {
i += 1;
assertTrue("stripe " + i + " is too long at " + stripe.getDataLength(), stripe.getDataLength() < 5000);
}
assertEquals(25, i);
assertEquals(2500, reader.getNumberOfRows());
reader.close();
}
Aggregations