Search in sources :

Example 21 with BlockBuilderStatus

use of com.facebook.presto.spi.block.BlockBuilderStatus in project presto by prestodb.

the class TestTimestampWithTimeZoneType method createTestBlock.

public static Block createTestBlock() {
    BlockBuilder blockBuilder = TIMESTAMP_WITH_TIME_ZONE.createBlockBuilder(new BlockBuilderStatus(), 15);
    TIMESTAMP_WITH_TIME_ZONE.writeLong(blockBuilder, packDateTimeWithZone(1111, getTimeZoneKeyForOffset(0)));
    TIMESTAMP_WITH_TIME_ZONE.writeLong(blockBuilder, packDateTimeWithZone(1111, getTimeZoneKeyForOffset(1)));
    TIMESTAMP_WITH_TIME_ZONE.writeLong(blockBuilder, packDateTimeWithZone(1111, getTimeZoneKeyForOffset(2)));
    TIMESTAMP_WITH_TIME_ZONE.writeLong(blockBuilder, packDateTimeWithZone(2222, getTimeZoneKeyForOffset(3)));
    TIMESTAMP_WITH_TIME_ZONE.writeLong(blockBuilder, packDateTimeWithZone(2222, getTimeZoneKeyForOffset(4)));
    TIMESTAMP_WITH_TIME_ZONE.writeLong(blockBuilder, packDateTimeWithZone(2222, getTimeZoneKeyForOffset(5)));
    TIMESTAMP_WITH_TIME_ZONE.writeLong(blockBuilder, packDateTimeWithZone(2222, getTimeZoneKeyForOffset(6)));
    TIMESTAMP_WITH_TIME_ZONE.writeLong(blockBuilder, packDateTimeWithZone(2222, getTimeZoneKeyForOffset(7)));
    TIMESTAMP_WITH_TIME_ZONE.writeLong(blockBuilder, packDateTimeWithZone(3333, getTimeZoneKeyForOffset(8)));
    TIMESTAMP_WITH_TIME_ZONE.writeLong(blockBuilder, packDateTimeWithZone(3333, getTimeZoneKeyForOffset(9)));
    TIMESTAMP_WITH_TIME_ZONE.writeLong(blockBuilder, packDateTimeWithZone(4444, getTimeZoneKeyForOffset(10)));
    return blockBuilder.build();
}
Also used : BlockBuilder(com.facebook.presto.spi.block.BlockBuilder) BlockBuilderStatus(com.facebook.presto.spi.block.BlockBuilderStatus)

Example 22 with BlockBuilderStatus

use of com.facebook.presto.spi.block.BlockBuilderStatus in project presto by prestodb.

the class TestTinyintArrayType method getGreaterValue.

@Override
protected Object getGreaterValue(Object value) {
    Block block = (Block) value;
    BlockBuilder blockBuilder = TINYINT.createBlockBuilder(new BlockBuilderStatus(), block.getPositionCount() + 1);
    for (int i = 0; i < block.getPositionCount(); i++) {
        TINYINT.appendTo(block, i, blockBuilder);
    }
    TINYINT.writeLong(blockBuilder, 1L);
    return blockBuilder.build();
}
Also used : Block(com.facebook.presto.spi.block.Block) BlockBuilder(com.facebook.presto.spi.block.BlockBuilder) BlockBuilderStatus(com.facebook.presto.spi.block.BlockBuilderStatus)

Example 23 with BlockBuilderStatus

use of com.facebook.presto.spi.block.BlockBuilderStatus in project presto by prestodb.

the class TestDoubleType method createTestBlock.

public static Block createTestBlock() {
    BlockBuilder blockBuilder = DOUBLE.createBlockBuilder(new BlockBuilderStatus(), 15);
    DOUBLE.writeDouble(blockBuilder, 11.11);
    DOUBLE.writeDouble(blockBuilder, 11.11);
    DOUBLE.writeDouble(blockBuilder, 11.11);
    DOUBLE.writeDouble(blockBuilder, 22.22);
    DOUBLE.writeDouble(blockBuilder, 22.22);
    DOUBLE.writeDouble(blockBuilder, 22.22);
    DOUBLE.writeDouble(blockBuilder, 22.22);
    DOUBLE.writeDouble(blockBuilder, 22.22);
    DOUBLE.writeDouble(blockBuilder, 33.33);
    DOUBLE.writeDouble(blockBuilder, 33.33);
    DOUBLE.writeDouble(blockBuilder, 44.44);
    return blockBuilder.build();
}
Also used : BlockBuilder(com.facebook.presto.spi.block.BlockBuilder) BlockBuilderStatus(com.facebook.presto.spi.block.BlockBuilderStatus)

Example 24 with BlockBuilderStatus

use of com.facebook.presto.spi.block.BlockBuilderStatus in project presto by prestodb.

the class TestIntegerArrayType method getGreaterValue.

@Override
protected Object getGreaterValue(Object value) {
    Block block = (Block) value;
    BlockBuilder blockBuilder = INTEGER.createBlockBuilder(new BlockBuilderStatus(), block.getPositionCount() + 1);
    for (int i = 0; i < block.getPositionCount(); i++) {
        INTEGER.appendTo(block, i, blockBuilder);
    }
    INTEGER.writeLong(blockBuilder, 1L);
    return blockBuilder.build();
}
Also used : Block(com.facebook.presto.spi.block.Block) BlockBuilder(com.facebook.presto.spi.block.BlockBuilder) BlockBuilderStatus(com.facebook.presto.spi.block.BlockBuilderStatus)

Example 25 with BlockBuilderStatus

use of com.facebook.presto.spi.block.BlockBuilderStatus in project presto by prestodb.

the class TestIntegerType method createTestBlock.

public static Block createTestBlock() {
    BlockBuilder blockBuilder = INTEGER.createBlockBuilder(new BlockBuilderStatus(), 15);
    INTEGER.writeLong(blockBuilder, 1111);
    INTEGER.writeLong(blockBuilder, 1111);
    INTEGER.writeLong(blockBuilder, 1111);
    INTEGER.writeLong(blockBuilder, 2222);
    INTEGER.writeLong(blockBuilder, 2222);
    INTEGER.writeLong(blockBuilder, 2222);
    INTEGER.writeLong(blockBuilder, 2222);
    INTEGER.writeLong(blockBuilder, 2222);
    INTEGER.writeLong(blockBuilder, 3333);
    INTEGER.writeLong(blockBuilder, 3333);
    INTEGER.writeLong(blockBuilder, 4444);
    return blockBuilder.build();
}
Also used : BlockBuilder(com.facebook.presto.spi.block.BlockBuilder) BlockBuilderStatus(com.facebook.presto.spi.block.BlockBuilderStatus)

Aggregations

BlockBuilderStatus (com.facebook.presto.spi.block.BlockBuilderStatus)227 BlockBuilder (com.facebook.presto.spi.block.BlockBuilder)210 Block (com.facebook.presto.spi.block.Block)55 Slice (io.airlift.slice.Slice)43 InterleavedBlockBuilder (com.facebook.presto.spi.block.InterleavedBlockBuilder)37 Test (org.testng.annotations.Test)35 Type (com.facebook.presto.spi.type.Type)24 SqlType (com.facebook.presto.spi.function.SqlType)20 UsedByGeneratedCode (com.facebook.presto.annotation.UsedByGeneratedCode)15 ArrayType (com.facebook.presto.type.ArrayType)14 Page (com.facebook.presto.spi.Page)12 TypeJsonUtils.appendToBlockBuilder (com.facebook.presto.type.TypeJsonUtils.appendToBlockBuilder)12 TypeParameter (com.facebook.presto.spi.function.TypeParameter)11 RowType (com.facebook.presto.type.RowType)11 OrcCorruptionException (com.facebook.presto.orc.OrcCorruptionException)10 RunLengthEncodedBlock (com.facebook.presto.spi.block.RunLengthEncodedBlock)10 MapType (com.facebook.presto.type.MapType)10 PrestoException (com.facebook.presto.spi.PrestoException)9 BlockAssertions.createLongsBlock (com.facebook.presto.block.BlockAssertions.createLongsBlock)8 DecimalType (com.facebook.presto.spi.type.DecimalType)8