Search in sources :

Example 1 with StreamLayoutType

use of com.facebook.presto.hive.OrcFileWriterConfig.StreamLayoutType 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

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