Search in sources :

Example 1 with SingleRowBlockWriter

use of io.prestosql.spi.block.SingleRowBlockWriter in project hetu-core by openlookeng.

the class TestSimpleRowType method getGreaterValue.

@Override
protected Object getGreaterValue(Object value) {
    RowBlockBuilder blockBuilder = (RowBlockBuilder) TYPE.createBlockBuilder(null, 1);
    SingleRowBlockWriter singleRowBlockWriter;
    Block block = (Block) value;
    singleRowBlockWriter = blockBuilder.beginBlockEntry();
    BIGINT.writeLong(singleRowBlockWriter, block.getSingleValueBlock(0).getLong(0, 0) + 1);
    VARCHAR.writeSlice(singleRowBlockWriter, block.getSingleValueBlock(1).getSlice(0, 0, 1));
    blockBuilder.closeEntry();
    return TYPE.getObject(blockBuilder.build(), 0);
}
Also used : RowBlockBuilder(io.prestosql.spi.block.RowBlockBuilder) Block(io.prestosql.spi.block.Block) SingleRowBlockWriter(io.prestosql.spi.block.SingleRowBlockWriter)

Example 2 with SingleRowBlockWriter

use of io.prestosql.spi.block.SingleRowBlockWriter in project hetu-core by openlookeng.

the class TestSimpleRowType method createTestBlock.

private static Block createTestBlock() {
    RowBlockBuilder blockBuilder = (RowBlockBuilder) TYPE.createBlockBuilder(null, 3);
    SingleRowBlockWriter singleRowBlockWriter;
    singleRowBlockWriter = blockBuilder.beginBlockEntry();
    BIGINT.writeLong(singleRowBlockWriter, 1);
    VARCHAR.writeSlice(singleRowBlockWriter, utf8Slice("cat"));
    blockBuilder.closeEntry();
    singleRowBlockWriter = blockBuilder.beginBlockEntry();
    BIGINT.writeLong(singleRowBlockWriter, 2);
    VARCHAR.writeSlice(singleRowBlockWriter, utf8Slice("cats"));
    blockBuilder.closeEntry();
    singleRowBlockWriter = blockBuilder.beginBlockEntry();
    BIGINT.writeLong(singleRowBlockWriter, 3);
    VARCHAR.writeSlice(singleRowBlockWriter, utf8Slice("dog"));
    blockBuilder.closeEntry();
    return blockBuilder.build();
}
Also used : RowBlockBuilder(io.prestosql.spi.block.RowBlockBuilder) SingleRowBlockWriter(io.prestosql.spi.block.SingleRowBlockWriter)

Aggregations

RowBlockBuilder (io.prestosql.spi.block.RowBlockBuilder)2 SingleRowBlockWriter (io.prestosql.spi.block.SingleRowBlockWriter)2 Block (io.prestosql.spi.block.Block)1