use of io.airlift.slice.SliceOutput in project presto by prestodb.
the class LongDecimalWithOverflowAndLongStateSerializer method serialize.
@Override
public void serialize(LongDecimalWithOverflowAndLongState state, BlockBuilder out) {
if (state.getLongDecimal() == null) {
out.appendNull();
} else {
Slice slice = Slices.allocate(Long.BYTES + Long.BYTES + UnscaledDecimal128Arithmetic.UNSCALED_DECIMAL_128_SLICE_LENGTH);
SliceOutput output = slice.getOutput();
output.writeLong(state.getLong());
output.writeLong(state.getOverflow());
output.writeBytes(state.getLongDecimal());
VARBINARY.writeSlice(out, slice);
}
}
Aggregations