Search in sources :

Example 11 with BlockBuilder

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

the class TestShortDecimalType method createTestBlock.

public static Block createTestBlock() {
    BlockBuilder blockBuilder = SHORT_DECIMAL_TYPE.createBlockBuilder(null, 15);
    SHORT_DECIMAL_TYPE.writeLong(blockBuilder, -1234);
    SHORT_DECIMAL_TYPE.writeLong(blockBuilder, -1234);
    SHORT_DECIMAL_TYPE.writeLong(blockBuilder, -1234);
    SHORT_DECIMAL_TYPE.writeLong(blockBuilder, 2321);
    SHORT_DECIMAL_TYPE.writeLong(blockBuilder, 2321);
    SHORT_DECIMAL_TYPE.writeLong(blockBuilder, 2321);
    SHORT_DECIMAL_TYPE.writeLong(blockBuilder, 2321);
    SHORT_DECIMAL_TYPE.writeLong(blockBuilder, 2321);
    SHORT_DECIMAL_TYPE.writeLong(blockBuilder, 3321);
    SHORT_DECIMAL_TYPE.writeLong(blockBuilder, 3321);
    SHORT_DECIMAL_TYPE.writeLong(blockBuilder, 4321);
    return blockBuilder.build();
}
Also used : BlockBuilder(io.prestosql.spi.block.BlockBuilder)

Example 12 with BlockBuilder

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

the class TestSmallintArrayType method createTestBlock.

public static Block createTestBlock(Type arrayType) {
    BlockBuilder blockBuilder = arrayType.createBlockBuilder(null, 4);
    arrayType.writeObject(blockBuilder, arrayBlockOf(SMALLINT, 1, 2));
    arrayType.writeObject(blockBuilder, arrayBlockOf(SMALLINT, 1, 2, 3));
    arrayType.writeObject(blockBuilder, arrayBlockOf(SMALLINT, 1, 2, 3));
    arrayType.writeObject(blockBuilder, arrayBlockOf(SMALLINT, 100, 200, 300));
    return blockBuilder.build();
}
Also used : BlockBuilder(io.prestosql.spi.block.BlockBuilder)

Example 13 with BlockBuilder

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

the class TestTimeType method createTestBlock.

public static Block createTestBlock() {
    BlockBuilder blockBuilder = TIME.createBlockBuilder(null, 15);
    TIME.writeLong(blockBuilder, 1111);
    TIME.writeLong(blockBuilder, 1111);
    TIME.writeLong(blockBuilder, 1111);
    TIME.writeLong(blockBuilder, 2222);
    TIME.writeLong(blockBuilder, 2222);
    TIME.writeLong(blockBuilder, 2222);
    TIME.writeLong(blockBuilder, 2222);
    TIME.writeLong(blockBuilder, 2222);
    TIME.writeLong(blockBuilder, 3333);
    TIME.writeLong(blockBuilder, 3333);
    TIME.writeLong(blockBuilder, 4444);
    return blockBuilder.build();
}
Also used : BlockBuilder(io.prestosql.spi.block.BlockBuilder)

Example 14 with BlockBuilder

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

the class TestIntegerVarcharMapType method createTestBlock.

public static Block createTestBlock(Type mapType) {
    BlockBuilder blockBuilder = mapType.createBlockBuilder(null, 2);
    mapType.writeObject(blockBuilder, mapBlockOf(INTEGER, VARCHAR, ImmutableMap.of(1, "hi")));
    mapType.writeObject(blockBuilder, mapBlockOf(INTEGER, VARCHAR, ImmutableMap.of(1, "2", 2, "hello")));
    return blockBuilder.build();
}
Also used : BlockBuilder(io.prestosql.spi.block.BlockBuilder)

Example 15 with BlockBuilder

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

the class TestIntervalDayTimeType method createTestBlock.

public static Block createTestBlock() {
    BlockBuilder blockBuilder = INTERVAL_DAY_TIME.createBlockBuilder(null, 15);
    INTERVAL_DAY_TIME.writeLong(blockBuilder, 1111);
    INTERVAL_DAY_TIME.writeLong(blockBuilder, 1111);
    INTERVAL_DAY_TIME.writeLong(blockBuilder, 1111);
    INTERVAL_DAY_TIME.writeLong(blockBuilder, 2222);
    INTERVAL_DAY_TIME.writeLong(blockBuilder, 2222);
    INTERVAL_DAY_TIME.writeLong(blockBuilder, 2222);
    INTERVAL_DAY_TIME.writeLong(blockBuilder, 2222);
    INTERVAL_DAY_TIME.writeLong(blockBuilder, 2222);
    INTERVAL_DAY_TIME.writeLong(blockBuilder, 3333);
    INTERVAL_DAY_TIME.writeLong(blockBuilder, 3333);
    INTERVAL_DAY_TIME.writeLong(blockBuilder, 4444);
    return blockBuilder.build();
}
Also used : BlockBuilder(io.prestosql.spi.block.BlockBuilder)

Aggregations

BlockBuilder (io.prestosql.spi.block.BlockBuilder)440 Block (io.prestosql.spi.block.Block)100 Test (org.testng.annotations.Test)84 Slice (io.airlift.slice.Slice)80 Type (io.prestosql.spi.type.Type)78 Page (io.prestosql.spi.Page)52 SqlType (io.prestosql.spi.function.SqlType)42 ArrayType (io.prestosql.spi.type.ArrayType)38 Map (java.util.Map)36 RowType (io.prestosql.spi.type.RowType)34 MapType (io.prestosql.spi.type.MapType)31 List (java.util.List)26 PageBuilder (io.prestosql.spi.PageBuilder)24 TimestampType (io.prestosql.spi.type.TimestampType)24 ImmutableList (com.google.common.collect.ImmutableList)23 PrestoException (io.prestosql.spi.PrestoException)23 BigintType (io.prestosql.spi.type.BigintType)23 BooleanType (io.prestosql.spi.type.BooleanType)21 DoubleType (io.prestosql.spi.type.DoubleType)21 UsedByGeneratedCode (io.prestosql.spi.annotation.UsedByGeneratedCode)20