本文整理了Java中io.prestosql.spi.type.Type.getSlice()
方法的一些代码示例,展示了Type.getSlice()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Type.getSlice()
方法的具体详情如下:
包路径:io.prestosql.spi.type.Type
类名称:Type
方法名:getSlice
[英]Gets the value at the block position as a Slice.
[中]获取块位置处作为切片的值。
代码示例来源:origin: io.prestosql/presto-main
@Override
void readFirstField(Block block, int position, SliceAndBlockPositionValueState state)
{
state.setFirst(firstType.getSlice(block, position));
}
代码示例来源:origin: prestosql/presto
@Override
void readFirstField(Block block, int position, SliceAndBlockPositionValueState state)
{
state.setFirst(firstType.getSlice(block, position));
}
代码示例来源:origin: io.prestosql/presto-main
@Override
public Slice getSlice(int field)
{
return types.get(field).getSlice(page.getBlock(field), position);
}
代码示例来源:origin: prestosql/presto
@Override
public Slice getSlice(int field)
{
return types.get(field).getSlice(page.getBlock(field), position);
}
代码示例来源:origin: io.prestosql/presto-main
@Override
public Slice getSlice(int field)
{
checkState(position >= 0, "Not yet advanced");
checkState(position < page.getPositionCount(), "Already finished");
Type type = types.get(field);
return type.getSlice(page.getBlock(field), position);
}
代码示例来源:origin: prestosql/presto
@Override
public Slice getSlice(int field)
{
checkState(position >= 0, "Not yet advanced");
checkState(position < page.getPositionCount(), "Already finished");
Type type = types.get(field);
return type.getSlice(page.getBlock(field), position);
}
代码示例来源:origin: prestosql/presto
@Override
public void encodeValueInto(int depth, Block block, int position, SliceOutput output)
{
Slice slice = type.getSlice(block, position);
if (escapeByte != null && slice.indexOfByte(escapeByte) < 0) {
throw new IllegalArgumentException("escape not implemented");
}
output.writeBytes(slice);
}
代码示例来源:origin: prestosql/presto
@Override
public void setField(Block block, int position)
{
value.set(type.getSlice(block, position).getBytes());
rowInspector.setStructFieldData(row, field, value);
}
}
代码示例来源:origin: prestosql/presto
@UsedByGeneratedCode
public static Slice sliceSubscript(Type elementType, Block array, long index)
{
checkIndex(array, index);
int position = toIntExact(index - 1);
if (array.isNull(position)) {
return null;
}
return elementType.getSlice(array, position);
}
代码示例来源:origin: io.prestosql/presto-main
@UsedByGeneratedCode
public static Slice sliceSubscript(Type elementType, Block array, long index)
{
checkIndex(array, index);
int position = toIntExact(index - 1);
if (array.isNull(position)) {
return null;
}
return elementType.getSlice(array, position);
}
代码示例来源:origin: prestosql/presto
@Override
public void encodeValueInto(int depth, Block block, int position, SliceOutput output)
{
Slice slice = type.getSlice(block, position);
byte[] data = slice.getBytes();
slice = Slices.wrappedBuffer(base64Encoder.encode(data));
output.writeBytes(slice);
}
代码示例来源:origin: io.prestosql/presto-main
public Slice getSlice(int channel, int position)
{
long pageAddress = valueAddresses.getLong(position);
Block block = channels[channel].get(decodeSliceIndex(pageAddress));
int blockPosition = decodePosition(pageAddress);
return types.get(channel).getSlice(block, blockPosition);
}
代码示例来源:origin: io.prestosql/presto-orc
@Override
default void addBlock(Type type, Block block)
{
for (int position = 0; position < block.getPositionCount(); position++) {
if (!block.isNull(position)) {
addValue(type.getSlice(block, position));
}
}
}
代码示例来源:origin: prestosql/presto
@Override
public void encodeValueInto(Block block, int position, SliceOutput output)
{
Slice slice = type.getSlice(block, position);
// Note binary nested in complex structures do no use the empty marker.
// Therefore, empty VARBINARY values are ok.
writeVInt(output, slice.length());
output.writeBytes(slice);
}
代码示例来源:origin: prestosql/presto
@Override
public void encodeValueInto(Block block, int position, SliceOutput output)
{
Slice slice = type.getSlice(block, position);
// Note strings nested in complex structures do no use the empty string marker
writeVInt(output, slice.length());
output.writeBytes(slice);
}
代码示例来源:origin: io.prestosql/presto-main
@InputFunction
public static void input(Type type, QuantileDigestState state, Block value, int index)
{
merge(state, new QuantileDigest(type.getSlice(value, index)));
}
代码示例来源:origin: prestosql/presto
@Override
public void addBlock(Type type, Block block)
{
int scale = ((DecimalType) type).getScale();
for (int position = 0; position < block.getPositionCount(); position++) {
if (!block.isNull(position)) {
Slice value = type.getSlice(block, position);
addValue(new BigDecimal(Decimals.decodeUnscaledValue(value), scale));
}
}
}
代码示例来源:origin: io.prestosql/presto-orc
@Override
public void addBlock(Type type, Block block)
{
int scale = ((DecimalType) type).getScale();
for (int position = 0; position < block.getPositionCount(); position++) {
if (!block.isNull(position)) {
Slice value = type.getSlice(block, position);
addValue(new BigDecimal(Decimals.decodeUnscaledValue(value), scale));
}
}
}
代码示例来源:origin: io.prestosql/presto-main
@TypeParameter("E")
@SqlType("E")
public static Slice specializedSlice(@TypeParameter("E") Type type, @BlockPosition @SqlType(value = "E", nativeContainerType = Slice.class) Block block, @BlockIndex int position)
{
hitBlockPositionSlice.set(true);
return type.getSlice(block, position);
}
代码示例来源:origin: prestosql/presto
private static void assertLearnClassifer(Accumulator accumulator)
{
accumulator.addInput(getPage());
BlockBuilder finalOut = accumulator.getFinalType().createBlockBuilder(null, 1);
accumulator.evaluateFinal(finalOut);
Block block = finalOut.build();
Slice slice = accumulator.getFinalType().getSlice(block, 0);
Model deserialized = ModelUtils.deserialize(slice);
assertNotNull(deserialized, "deserialization failed");
assertTrue(deserialized instanceof Classifier, "deserialized model is not a classifier");
}
内容来源于网络,如有侵权,请联系作者删除!