use of com.facebook.presto.common.block.ByteArrayBlockBuilder in project presto by prestodb.
the class TestRunLengthEncodedBlock method testBuildingFromByteArrayBlockBuilder.
@Test
public void testBuildingFromByteArrayBlockBuilder() {
ByteArrayBlockBuilder blockBuilder = new ByteArrayBlockBuilder(null, 100);
populateNullValues(blockBuilder, 100);
assertEquals(blockBuilder.build().getEncodingName(), RunLengthBlockEncoding.NAME);
}
use of com.facebook.presto.common.block.ByteArrayBlockBuilder in project presto by prestodb.
the class TestByteArrayBlock method createBlockBuilderWithValues.
private static BlockBuilder createBlockBuilderWithValues(Slice[] expectedValues) {
ByteArrayBlockBuilder blockBuilder = new ByteArrayBlockBuilder(null, expectedValues.length);
writeValues(expectedValues, blockBuilder);
return blockBuilder;
}
use of com.facebook.presto.common.block.ByteArrayBlockBuilder in project presto by prestodb.
the class TestByteArrayBlock method testLazyBlockBuilderInitialization.
@Test
public void testLazyBlockBuilderInitialization() {
Slice[] expectedValues = createTestValue(100);
BlockBuilder emptyBlockBuilder = new ByteArrayBlockBuilder(null, 0);
BlockBuilder blockBuilder = new ByteArrayBlockBuilder(null, expectedValues.length);
assertEquals(blockBuilder.getSizeInBytes(), emptyBlockBuilder.getSizeInBytes());
assertEquals(blockBuilder.getRetainedSizeInBytes(), emptyBlockBuilder.getRetainedSizeInBytes());
writeValues(expectedValues, blockBuilder);
assertTrue(blockBuilder.getSizeInBytes() > emptyBlockBuilder.getSizeInBytes());
assertTrue(blockBuilder.getRetainedSizeInBytes() > emptyBlockBuilder.getRetainedSizeInBytes());
blockBuilder = blockBuilder.newBlockBuilderLike(null);
assertEquals(blockBuilder.getSizeInBytes(), emptyBlockBuilder.getSizeInBytes());
assertEquals(blockBuilder.getRetainedSizeInBytes(), emptyBlockBuilder.getRetainedSizeInBytes());
}
Aggregations