use of io.prestosql.spi.block.BlockBuilder in project hetu-core by openlookeng.
the class TestUuidOperators method hashFromType.
private static long hashFromType(String uuidString) {
BlockBuilder blockBuilder = UUID.createBlockBuilder(null, 1);
UUID.writeSlice(blockBuilder, castFromVarcharToUuid(utf8Slice(uuidString)));
Block block = blockBuilder.build();
return UUID.hash(block, 0);
}
use of io.prestosql.spi.block.BlockBuilder in project hetu-core by openlookeng.
the class TestVarbinaryType method createTestBlock.
public static Block createTestBlock() {
BlockBuilder blockBuilder = VARBINARY.createBlockBuilder(null, 15);
VARBINARY.writeSlice(blockBuilder, Slices.utf8Slice("apple"));
VARBINARY.writeSlice(blockBuilder, Slices.utf8Slice("apple"));
VARBINARY.writeSlice(blockBuilder, Slices.utf8Slice("apple"));
VARBINARY.writeSlice(blockBuilder, Slices.utf8Slice("banana"));
VARBINARY.writeSlice(blockBuilder, Slices.utf8Slice("banana"));
VARBINARY.writeSlice(blockBuilder, Slices.utf8Slice("banana"));
VARBINARY.writeSlice(blockBuilder, Slices.utf8Slice("banana"));
VARBINARY.writeSlice(blockBuilder, Slices.utf8Slice("banana"));
VARBINARY.writeSlice(blockBuilder, Slices.utf8Slice("cherry"));
VARBINARY.writeSlice(blockBuilder, Slices.utf8Slice("cherry"));
VARBINARY.writeSlice(blockBuilder, Slices.utf8Slice("date"));
return blockBuilder.build();
}
use of io.prestosql.spi.block.BlockBuilder in project hetu-core by openlookeng.
the class TestVarcharType method createTestBlock.
public static Block createTestBlock() {
BlockBuilder blockBuilder = VARCHAR.createBlockBuilder(null, 15);
VARCHAR.writeString(blockBuilder, "apple");
VARCHAR.writeString(blockBuilder, "apple");
VARCHAR.writeString(blockBuilder, "apple");
VARCHAR.writeString(blockBuilder, "banana");
VARCHAR.writeString(blockBuilder, "banana");
VARCHAR.writeString(blockBuilder, "banana");
VARCHAR.writeString(blockBuilder, "banana");
VARCHAR.writeString(blockBuilder, "banana");
VARCHAR.writeString(blockBuilder, "cherry");
VARCHAR.writeString(blockBuilder, "cherry");
VARCHAR.writeString(blockBuilder, "date");
return blockBuilder.build();
}
use of io.prestosql.spi.block.BlockBuilder in project hetu-core by openlookeng.
the class TestPage method createSlicesBlock.
private static Block createSlicesBlock(Slice[] values) {
BlockBuilder builder = VARBINARY.createBlockBuilder(null, 100);
for (Slice value : values) {
verify(value != null);
VARBINARY.writeSlice(builder, value);
}
return builder.build();
}
use of io.prestosql.spi.block.BlockBuilder in project hetu-core by openlookeng.
the class AbstractTestType method createBlock.
private static Block createBlock(Type type, Object value) {
BlockBuilder blockBuilder = type.createBlockBuilder(null, 1);
Class<?> javaType = type.getJavaType();
if (value == null) {
blockBuilder.appendNull();
} else if (javaType == boolean.class) {
type.writeBoolean(blockBuilder, (Boolean) value);
} else if (javaType == long.class) {
type.writeLong(blockBuilder, (Long) value);
} else if (javaType == double.class) {
type.writeDouble(blockBuilder, (Double) value);
} else if (javaType == Slice.class) {
Slice slice = (Slice) value;
type.writeSlice(blockBuilder, slice, 0, slice.length());
} else {
type.writeObject(blockBuilder, value);
}
return blockBuilder.build();
}
Aggregations