Search in sources :

Example 16 with BlockBuilder

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

the class TestIntervalYearMonthType method createTestBlock.

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

Example 17 with BlockBuilder

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

the class TestIpAddressOperators method hashFromType.

private static long hashFromType(String address) {
    BlockBuilder blockBuilder = IPADDRESS.createBlockBuilder(null, 1);
    IPADDRESS.writeSlice(blockBuilder, Slices.wrappedBuffer(InetAddresses.forString(address).getAddress()));
    Block block = blockBuilder.build();
    return IPADDRESS.hash(block, 0);
}
Also used : Block(io.prestosql.spi.block.Block) BlockBuilder(io.prestosql.spi.block.BlockBuilder)

Example 18 with BlockBuilder

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

the class TestIpAddressType method createTestBlock.

public static Block createTestBlock() {
    BlockBuilder blockBuilder = IPADDRESS.createBlockBuilder(null, 1);
    IPADDRESS.writeSlice(blockBuilder, getSliceForAddress("2001:db8::ff00:42:8320"));
    IPADDRESS.writeSlice(blockBuilder, getSliceForAddress("2001:db8::ff00:42:8321"));
    IPADDRESS.writeSlice(blockBuilder, getSliceForAddress("2001:db8::ff00:42:8322"));
    IPADDRESS.writeSlice(blockBuilder, getSliceForAddress("2001:db8::ff00:42:8323"));
    IPADDRESS.writeSlice(blockBuilder, getSliceForAddress("2001:db8::ff00:42:8324"));
    IPADDRESS.writeSlice(blockBuilder, getSliceForAddress("2001:db8::ff00:42:8325"));
    IPADDRESS.writeSlice(blockBuilder, getSliceForAddress("2001:db8::ff00:42:8326"));
    IPADDRESS.writeSlice(blockBuilder, getSliceForAddress("2001:db8::ff00:42:8327"));
    IPADDRESS.writeSlice(blockBuilder, getSliceForAddress("2001:db8::ff00:42:8328"));
    IPADDRESS.writeSlice(blockBuilder, getSliceForAddress("2001:db8::ff00:42:8329"));
    return blockBuilder.build();
}
Also used : BlockBuilder(io.prestosql.spi.block.BlockBuilder)

Example 19 with BlockBuilder

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

the class TestTinyintArrayType method createTestBlock.

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

Example 20 with BlockBuilder

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

the class TestTinyintVarcharMapType method createTestBlock.

public static Block createTestBlock(Type mapType) {
    BlockBuilder blockBuilder = mapType.createBlockBuilder(null, 2);
    mapType.writeObject(blockBuilder, mapBlockOf(TINYINT, VARCHAR, ImmutableMap.of(1, "hi")));
    mapType.writeObject(blockBuilder, mapBlockOf(TINYINT, VARCHAR, ImmutableMap.of(1, "2", 2, "hello")));
    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