Search in sources :

Example 6 with RowBlockBuilder

use of com.facebook.presto.common.block.RowBlockBuilder in project presto by prestodb.

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) + 1);
    VARCHAR.writeSlice(singleRowBlockWriter, block.getSingleValueBlock(1).getSlice(0, 0, 1));
    blockBuilder.closeEntry();
    return TYPE.getObject(blockBuilder.build(), 0);
}
Also used : RowBlockBuilder(com.facebook.presto.common.block.RowBlockBuilder) Block(com.facebook.presto.common.block.Block) SingleRowBlockWriter(com.facebook.presto.common.block.SingleRowBlockWriter)

Aggregations

RowBlockBuilder (com.facebook.presto.common.block.RowBlockBuilder)6 BlockBuilder (com.facebook.presto.common.block.BlockBuilder)4 SingleRowBlockWriter (com.facebook.presto.common.block.SingleRowBlockWriter)3 Block (com.facebook.presto.common.block.Block)2 RowType (com.facebook.presto.common.type.RowType)2 StructuralTestUtil.appendToBlockBuilder (com.facebook.presto.util.StructuralTestUtil.appendToBlockBuilder)2 Slice (io.airlift.slice.Slice)2 Slices.utf8Slice (io.airlift.slice.Slices.utf8Slice)2 ArrayBlock.fromElementBlock (com.facebook.presto.common.block.ArrayBlock.fromElementBlock)1 ArrayBlockBuilder (com.facebook.presto.common.block.ArrayBlockBuilder)1 DictionaryBlock (com.facebook.presto.common.block.DictionaryBlock)1 MapBlockBuilder (com.facebook.presto.common.block.MapBlockBuilder)1 RunLengthEncodedBlock (com.facebook.presto.common.block.RunLengthEncodedBlock)1 ArrayType (com.facebook.presto.common.type.ArrayType)1 MapType (com.facebook.presto.common.type.MapType)1 Type (com.facebook.presto.common.type.Type)1 BigInteger (java.math.BigInteger)1 Test (org.testng.annotations.Test)1