use of com.facebook.presto.orc.writer.StreamLayoutFactory.StreamSizeLayoutFactory in project presto by prestodb.
the class TestOrcFileWriterConfig method testStreamLayoutOption.
@Test
public void testStreamLayoutOption() {
OrcFileWriterConfig config = new OrcFileWriterConfig();
config.setStreamLayoutType(BY_STREAM_SIZE);
OrcWriterOptions options = config.toOrcWriterOptionsBuilder().build();
assertTrue(options.getStreamLayoutFactory() instanceof StreamSizeLayoutFactory);
config.setStreamLayoutType(BY_COLUMN_SIZE);
options = config.toOrcWriterOptionsBuilder().build();
assertTrue(options.getStreamLayoutFactory() instanceof ColumnSizeLayoutFactory);
}
use of com.facebook.presto.orc.writer.StreamLayoutFactory.StreamSizeLayoutFactory in project presto by prestodb.
the class TestOrcFileWriterConfig method testOrcWriterOptionsBuilder.
@Test
public void testOrcWriterOptionsBuilder() {
DataSize stripeMinSize = new DataSize(10, MEGABYTE);
DataSize stripeMaxSize = new DataSize(50, MEGABYTE);
int stripeMaxRowCount = 1_000_000;
int rowGroupMaxRowCount = 15_000;
DataSize dictionaryMaxMemory = new DataSize(20, MEGABYTE);
DataSize stringStatisticsLimit = new DataSize(32, BYTE);
DataSize maxCompressionBufferSize = new DataSize(512, KILOBYTE);
StreamLayoutType streamLayoutType = BY_STREAM_SIZE;
DataSize dwrfStripeCacheMaxSize = new DataSize(4, MEGABYTE);
DwrfStripeCacheMode dwrfStripeCacheMode = INDEX;
OrcFileWriterConfig config = new OrcFileWriterConfig().setStripeMinSize(stripeMinSize).setStripeMaxSize(stripeMaxSize).setStripeMaxRowCount(stripeMaxRowCount).setRowGroupMaxRowCount(rowGroupMaxRowCount).setDictionaryMaxMemory(dictionaryMaxMemory).setStringStatisticsLimit(stringStatisticsLimit).setMaxCompressionBufferSize(maxCompressionBufferSize).setStreamLayoutType(streamLayoutType).setDwrfStripeCacheEnabled(false).setDwrfStripeCacheMaxSize(dwrfStripeCacheMaxSize).setDwrfStripeCacheMode(dwrfStripeCacheMode);
assertEquals(stripeMinSize, config.getStripeMinSize());
assertEquals(stripeMaxSize, config.getStripeMaxSize());
assertEquals(stripeMaxRowCount, config.getStripeMaxRowCount());
assertEquals(rowGroupMaxRowCount, config.getRowGroupMaxRowCount());
assertEquals(dictionaryMaxMemory, config.getDictionaryMaxMemory());
assertEquals(stringStatisticsLimit, config.getStringStatisticsLimit());
assertEquals(maxCompressionBufferSize, config.getMaxCompressionBufferSize());
assertEquals(streamLayoutType, config.getStreamLayoutType());
assertFalse(config.isDwrfStripeCacheEnabled());
assertEquals(dwrfStripeCacheMaxSize, config.getDwrfStripeCacheMaxSize());
assertEquals(dwrfStripeCacheMode, config.getDwrfStripeCacheMode());
assertNotSame(config.toOrcWriterOptionsBuilder(), config.toOrcWriterOptionsBuilder());
OrcWriterOptions options = config.toOrcWriterOptionsBuilder().build();
assertEquals(toIntExact(stripeMinSize.toBytes()), options.getFlushPolicy().getStripeMinBytes());
assertEquals(toIntExact(stripeMaxSize.toBytes()), options.getFlushPolicy().getStripeMaxBytes());
assertEquals(stripeMaxRowCount, options.getFlushPolicy().getStripeMaxRowCount());
assertEquals(rowGroupMaxRowCount, options.getRowGroupMaxRowCount());
assertEquals(dictionaryMaxMemory, options.getDictionaryMaxMemory());
assertEquals(stringStatisticsLimit, options.getMaxStringStatisticsLimit());
assertEquals(maxCompressionBufferSize, options.getMaxCompressionBufferSize());
assertTrue(options.getStreamLayoutFactory() instanceof StreamSizeLayoutFactory);
assertEquals(Optional.empty(), options.getDwrfStripeCacheOptions());
}
Aggregations