use of com.facebook.presto.spi.block.BlockBuilderStatus in project presto by prestodb.
the class BlockEncoding method decodeColumn.
@Override
public final Block decodeColumn(ColumnData columnData) throws RcFileCorruptionException {
int size = columnData.rowCount();
Slice slice = columnData.getSlice();
BlockBuilder builder = type.createBlockBuilder(new BlockBuilderStatus(), size);
for (int i = 0; i < size; i++) {
int length = columnData.getLength(i);
int offset = columnData.getOffset(i);
if (!isNullSequence(slice, offset, length)) {
decodeValueInto(1, builder, slice, offset, length);
} else {
builder.appendNull();
}
}
return builder.build();
}
use of com.facebook.presto.spi.block.BlockBuilderStatus in project presto by prestodb.
the class BooleanEncoding method decodeColumn.
@Override
public Block decodeColumn(ColumnData columnData) {
int size = columnData.rowCount();
BlockBuilder builder = type.createBlockBuilder(new BlockBuilderStatus(), size);
Slice slice = columnData.getSlice();
for (int i = 0; i < size; i++) {
int offset = columnData.getOffset(i);
int length = columnData.getLength(i);
if (isTrue(slice, offset, length)) {
type.writeBoolean(builder, true);
} else if (isFalse(slice, offset, length)) {
type.writeBoolean(builder, false);
} else {
builder.appendNull();
}
}
return builder.build();
}
use of com.facebook.presto.spi.block.BlockBuilderStatus in project presto by prestodb.
the class DateEncoding method decodeColumn.
@Override
public Block decodeColumn(ColumnData columnData) {
int size = columnData.rowCount();
BlockBuilder builder = type.createBlockBuilder(new BlockBuilderStatus(), size);
Slice slice = columnData.getSlice();
for (int i = 0; i < size; i++) {
int offset = columnData.getOffset(i);
int length = columnData.getLength(i);
if (length == 0 || nullSequence.equals(0, nullSequence.length(), slice, offset, length)) {
builder.appendNull();
} else {
//noinspection deprecation
type.writeLong(builder, parseDate(slice, offset, length));
}
}
return builder.build();
}
use of com.facebook.presto.spi.block.BlockBuilderStatus in project presto by prestodb.
the class DecimalEncoding method decodeColumn.
@Override
public Block decodeColumn(ColumnData columnData) {
int size = columnData.rowCount();
BlockBuilder builder = type.createBlockBuilder(new BlockBuilderStatus(), size);
Slice slice = columnData.getSlice();
for (int i = 0; i < size; i++) {
int offset = columnData.getOffset(i);
int length = columnData.getLength(i);
if (length == 0 || nullSequence.equals(0, nullSequence.length(), slice, offset, length)) {
builder.appendNull();
} else if (isShortDecimal(type)) {
type.writeLong(builder, parseLong(slice, offset, length));
} else {
type.writeSlice(builder, parseSlice(slice, offset, length));
}
}
return builder.build();
}
use of com.facebook.presto.spi.block.BlockBuilderStatus in project presto by prestodb.
the class DateEncoding method decodeColumn.
@Override
public Block decodeColumn(ColumnData columnData) {
int size = columnData.rowCount();
BlockBuilder builder = type.createBlockBuilder(new BlockBuilderStatus(), size);
Slice slice = columnData.getSlice();
for (int i = 0; i < size; i++) {
int offset = columnData.getOffset(i);
int length = columnData.getLength(i);
if (length == 0) {
builder.appendNull();
} else {
long daysSinceEpoch = readVInt(slice, offset, length);
type.writeLong(builder, toIntExact(daysSinceEpoch));
}
}
return builder.build();
}
Aggregations