Search in sources :

Example 6 with LongArrayBlockBuilder

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);
}
Also used : LongArrayBlockBuilder(com.facebook.presto.common.block.LongArrayBlockBuilder) Test(org.testng.annotations.Test)

Example 7 with LongArrayBlockBuilder

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();
    }
}
Also used : LongArrayBlock(com.facebook.presto.common.block.LongArrayBlock) Block(com.facebook.presto.common.block.Block) LongArrayBlockBuilder(com.facebook.presto.common.block.LongArrayBlockBuilder) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Example 8 with LongArrayBlockBuilder

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;
}
Also used : LongArrayBlockBuilder(com.facebook.presto.common.block.LongArrayBlockBuilder)

Example 9 with LongArrayBlockBuilder

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();
    }
}
Also used : LongArrayBlock(com.facebook.presto.common.block.LongArrayBlock) Block(com.facebook.presto.common.block.Block) LongArrayBlockBuilder(com.facebook.presto.common.block.LongArrayBlockBuilder) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Aggregations

LongArrayBlockBuilder (com.facebook.presto.common.block.LongArrayBlockBuilder)9 Test (org.testng.annotations.Test)5 Block (com.facebook.presto.common.block.Block)4 Session (com.facebook.presto.Session)2 BlockBuilder (com.facebook.presto.common.block.BlockBuilder)2 LongArrayBlock (com.facebook.presto.common.block.LongArrayBlock)2 Type (com.facebook.presto.common.type.Type)2 TableFinishOperatorFactory (com.facebook.presto.operator.TableFinishOperator.TableFinishOperatorFactory)2 PlanNodeId (com.facebook.presto.spi.plan.PlanNodeId)2 ColumnStatisticMetadata (com.facebook.presto.spi.statistics.ColumnStatisticMetadata)2 StatisticAggregationsDescriptor (com.facebook.presto.sql.planner.plan.StatisticAggregationsDescriptor)2 Benchmark (org.openjdk.jmh.annotations.Benchmark)2 Page (com.facebook.presto.common.Page)1 ArrayType (com.facebook.presto.common.type.ArrayType)1 ShardInfo (com.facebook.presto.raptor.metadata.ShardInfo)1 RowExpression (com.facebook.presto.spi.relation.RowExpression)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Slice (io.airlift.slice.Slice)1 Slices.utf8Slice (io.airlift.slice.Slices.utf8Slice)1