use of io.trino.spi.block.ShortArrayBlockBuilder in project trino by trinodb.
the class TestRunLengthEncodedBlock method testBuildingFromShortArrayBlockBuilder.
@Test
public void testBuildingFromShortArrayBlockBuilder() {
ShortArrayBlockBuilder blockBuilder = new ShortArrayBlockBuilder(null, 100);
populateNullValues(blockBuilder, 100);
assertEquals(blockBuilder.build().getEncodingName(), RunLengthBlockEncoding.NAME);
}
use of io.trino.spi.block.ShortArrayBlockBuilder in project trino by trinodb.
the class TestShortArrayBlock method createBlockBuilderWithValues.
private static BlockBuilder createBlockBuilderWithValues(Slice[] expectedValues) {
ShortArrayBlockBuilder blockBuilder = new ShortArrayBlockBuilder(null, expectedValues.length);
writeValues(expectedValues, blockBuilder);
return blockBuilder;
}
use of io.trino.spi.block.ShortArrayBlockBuilder in project trino by trinodb.
the class TestShortArrayBlock method testLazyBlockBuilderInitialization.
@Test
public void testLazyBlockBuilderInitialization() {
Slice[] expectedValues = createTestValue(100);
BlockBuilder emptyBlockBuilder = new ShortArrayBlockBuilder(null, 0);
BlockBuilder blockBuilder = new ShortArrayBlockBuilder(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