Search in sources :

Example 1 with StreamSizeLayoutFactory

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);
}
Also used : OrcWriterOptions(com.facebook.presto.orc.OrcWriterOptions) ColumnSizeLayoutFactory(com.facebook.presto.orc.writer.StreamLayoutFactory.ColumnSizeLayoutFactory) StreamSizeLayoutFactory(com.facebook.presto.orc.writer.StreamLayoutFactory.StreamSizeLayoutFactory) Test(org.testng.annotations.Test)

Example 2 with StreamSizeLayoutFactory

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());
}
Also used : OrcWriterOptions(com.facebook.presto.orc.OrcWriterOptions) DwrfStripeCacheMode(com.facebook.presto.orc.metadata.DwrfStripeCacheMode) DataSize(io.airlift.units.DataSize) StreamSizeLayoutFactory(com.facebook.presto.orc.writer.StreamLayoutFactory.StreamSizeLayoutFactory) StreamLayoutType(com.facebook.presto.hive.OrcFileWriterConfig.StreamLayoutType) Test(org.testng.annotations.Test)

Aggregations

OrcWriterOptions (com.facebook.presto.orc.OrcWriterOptions)2 StreamSizeLayoutFactory (com.facebook.presto.orc.writer.StreamLayoutFactory.StreamSizeLayoutFactory)2 Test (org.testng.annotations.Test)2 StreamLayoutType (com.facebook.presto.hive.OrcFileWriterConfig.StreamLayoutType)1 DwrfStripeCacheMode (com.facebook.presto.orc.metadata.DwrfStripeCacheMode)1 ColumnSizeLayoutFactory (com.facebook.presto.orc.writer.StreamLayoutFactory.ColumnSizeLayoutFactory)1 DataSize (io.airlift.units.DataSize)1