use of com.facebook.presto.common.block.BlockBuilder in project presto by prestodb.
the class TestDoubleType method createTestBlock.
public static Block createTestBlock() {
BlockBuilder blockBuilder = DOUBLE.createBlockBuilder(null, 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();
}
use of com.facebook.presto.common.block.BlockBuilder in project presto by prestodb.
the class TestSmallintType method createTestBlock.
public static Block createTestBlock() {
BlockBuilder blockBuilder = SMALLINT.createBlockBuilder(null, 15);
SMALLINT.writeLong(blockBuilder, 1111);
SMALLINT.writeLong(blockBuilder, 1111);
SMALLINT.writeLong(blockBuilder, 1111);
SMALLINT.writeLong(blockBuilder, 2222);
SMALLINT.writeLong(blockBuilder, 2222);
SMALLINT.writeLong(blockBuilder, 2222);
SMALLINT.writeLong(blockBuilder, 2222);
SMALLINT.writeLong(blockBuilder, 2222);
SMALLINT.writeLong(blockBuilder, 3333);
SMALLINT.writeLong(blockBuilder, 3333);
SMALLINT.writeLong(blockBuilder, 4444);
return blockBuilder.build();
}
use of com.facebook.presto.common.block.BlockBuilder in project presto by prestodb.
the class TestMapOperators method assertMapHashOperator.
private void assertMapHashOperator(String inputString, Type keyType, Type valueType, List<Object> elements) {
checkArgument(elements.size() % 2 == 0, "the size of elements should be even number");
MapType mapType = mapType(keyType, valueType);
BlockBuilder mapArrayBuilder = mapType.createBlockBuilder(null, 1);
BlockBuilder singleMapWriter = mapArrayBuilder.beginBlockEntry();
for (int i = 0; i < elements.size(); i += 2) {
appendToBlockBuilder(keyType, elements.get(i), singleMapWriter);
appendToBlockBuilder(valueType, elements.get(i + 1), singleMapWriter);
}
mapArrayBuilder.closeEntry();
long hashResult = mapType.hash(mapArrayBuilder.build(), 0);
assertOperator(HASH_CODE, inputString, BIGINT, hashResult);
}
use of com.facebook.presto.common.block.BlockBuilder in project presto by prestodb.
the class TestColorArrayType method createTestBlock.
public static Block createTestBlock(Type arrayType) {
BlockBuilder blockBuilder = arrayType.createBlockBuilder(null, 4);
arrayType.writeObject(blockBuilder, arrayBlockOf(COLOR, 1, 2));
arrayType.writeObject(blockBuilder, arrayBlockOf(COLOR, 1, 2, 3));
arrayType.writeObject(blockBuilder, arrayBlockOf(COLOR, 1, 2, 3));
arrayType.writeObject(blockBuilder, arrayBlockOf(COLOR, 100, 200, 300));
return blockBuilder.build();
}
use of com.facebook.presto.common.block.BlockBuilder in project presto by prestodb.
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();
}
Aggregations