use of parquet.io.api.Binary in project presto by prestodb.
the class ParquetTimestampColumnReader method readValue.
@Override
protected void readValue(BlockBuilder blockBuilder, Type type) {
if (definitionLevel == columnDescriptor.getMaxDefinitionLevel()) {
Binary binary = valuesReader.readBytes();
type.writeLong(blockBuilder, getTimestampMillis(binary));
} else {
blockBuilder.appendNull();
}
}
use of parquet.io.api.Binary in project presto by prestodb.
the class ParquetLongDecimalColumnReader method readValue.
@Override
protected void readValue(BlockBuilder blockBuilder, Type type) {
if (definitionLevel == columnDescriptor.getMaxDefinitionLevel()) {
Binary value = valuesReader.readBytes();
type.writeSlice(blockBuilder, Decimals.encodeUnscaledValue(new BigInteger(value.getBytes())));
} else {
blockBuilder.appendNull();
}
}
use of parquet.io.api.Binary in project presto by prestodb.
the class TestParquetTimestampUtils method assertTimestampCorrect.
private static void assertTimestampCorrect(String timestampString) {
Timestamp timestamp = Timestamp.valueOf(timestampString);
Binary timestampBytes = NanoTimeUtils.getNanoTime(timestamp, false).toBinary();
long decodedTimestampMillis = getTimestampMillis(timestampBytes);
assertEquals(decodedTimestampMillis, timestamp.getTime());
}
use of parquet.io.api.Binary in project presto by prestodb.
the class ParquetBinaryColumnReader method readValue.
@Override
protected void readValue(BlockBuilder blockBuilder, Type type) {
if (definitionLevel == columnDescriptor.getMaxDefinitionLevel()) {
Binary binary = valuesReader.readBytes();
Slice value;
if (binary.length() == 0) {
value = EMPTY_SLICE;
} else {
value = wrappedBuffer(binary.getBytes());
}
if (isVarcharType(type)) {
value = truncateToLength(value, type);
}
if (isCharType(type)) {
value = trimSpacesAndTruncateToLength(value, type);
}
type.writeSlice(blockBuilder, value);
} else {
blockBuilder.appendNull();
}
}
Aggregations