use of io.trino.spi.block.ByteArrayBlockBuilder in project trino by trinodb.
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 io.trino.spi.block.ByteArrayBlockBuilder in project trino by trinodb.
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());
}
use of io.trino.spi.block.ByteArrayBlockBuilder in project trino by trinodb.
the class TestByteArrayBlock method createBlockBuilderWithValues.
private static BlockBuilder createBlockBuilderWithValues(Slice[] expectedValues) {
ByteArrayBlockBuilder blockBuilder = new ByteArrayBlockBuilder(null, expectedValues.length);
writeValues(expectedValues, blockBuilder);
return blockBuilder;
}
Aggregations