use of com.facebook.presto.common.block.LongArrayBlockBuilder in project presto by prestodb.
the class TestRunLengthEncodedBlock method testBuildingFromLongArrayBlockBuilder.
@Test
public void testBuildingFromLongArrayBlockBuilder() {
LongArrayBlockBuilder blockBuilder = new LongArrayBlockBuilder(null, 100);
populateNullValues(blockBuilder, 100);
assertEquals(blockBuilder.build().getEncodingName(), RunLengthBlockEncoding.NAME);
}
use of com.facebook.presto.common.block.LongArrayBlockBuilder in project presto by prestodb.
the class BenchmarkCopyBlock method copyBlockByWriteLong.
@Benchmark
public void copyBlockByWriteLong(BenchmarkData data) {
LongArrayBlockBuilder longArrayBlockBuilder = new LongArrayBlockBuilder(null, POSITIONS_PER_PAGE);
for (int i = 0; i < BLOCK_COUNT; i++) {
Block block = data.blocks.get(i);
int positionCount = block.getPositionCount();
for (int j = 0; j < positionCount; j++) {
longArrayBlockBuilder.writeLong(block.getLong(i));
}
Block outputBlock = longArrayBlockBuilder.build();
}
}
use of com.facebook.presto.common.block.LongArrayBlockBuilder in project presto by prestodb.
the class TestLongArrayBlock method createBlockBuilderWithValues.
private static BlockBuilder createBlockBuilderWithValues(Slice[] expectedValues) {
LongArrayBlockBuilder blockBuilder = new LongArrayBlockBuilder(null, expectedValues.length);
writeValues(expectedValues, blockBuilder);
return blockBuilder;
}
use of com.facebook.presto.common.block.LongArrayBlockBuilder in project presto by prestodb.
the class BenchmarkCopyBlock method copyBlockByAppend.
@Benchmark
public void copyBlockByAppend(BenchmarkData data) {
LongArrayBlockBuilder longArrayBlockBuilder = new LongArrayBlockBuilder(null, POSITIONS_PER_PAGE);
for (int i = 0; i < BLOCK_COUNT; i++) {
Block block = data.blocks.get(i);
int positionCount = block.getPositionCount();
for (int j = 0; j < positionCount; j++) {
BIGINT.appendTo(block, j, longArrayBlockBuilder);
}
Block outputBlock = longArrayBlockBuilder.build();
}
}
Aggregations