Java Code Examples for org.apache.parquet.io.api.RecordConsumer#addBinary()

The following examples show how to use org.apache.parquet.io.api.RecordConsumer#addBinary() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FixedLenDecimalParquetValueWriter.java    From Bats with Apache License 2.0 6 votes vote down vote up
@Override
public void writeValue(RecordConsumer consumer, DrillBuf buffer, int start, int end, int precision) {
  int typeLength = DecimalUtility.getMaxBytesSizeForPrecision(precision);
  int length = end - start;
  int startPos = typeLength - length;
  byte[] output = new byte[typeLength];
  if (startPos >= 0) {
    buffer.getBytes(start, output, startPos, length);
    if (output[startPos] < 0) {
      Arrays.fill(output, 0, output.length - length, (byte) -1);
    }
  } else {
    // in this case value from FIXED_LEN_BYTE_ARRAY or BINARY field with greater length was taken, ignore leading bytes
    buffer.getBytes(start - startPos, output, 0, length + startPos);
  }
  consumer.addBinary(Binary.fromReusedByteArray(output));
}
 
Example 2
Source File: BinaryDecimalParquetValueWriter.java    From Bats with Apache License 2.0 4 votes vote down vote up
@Override
public void writeValue(RecordConsumer consumer, DrillBuf buffer, int start, int end, int precision) {
  consumer.addBinary(Binary.fromReusedByteBuffer(buffer.nioBuffer(start, end - start)));
}
 
Example 3
Source File: BinaryValue.java    From parquet-mr with Apache License 2.0 4 votes vote down vote up
@Override
public void writeValue(RecordConsumer recordConsumer) {
  recordConsumer.addBinary(binary);
}
 
Example 4
Source File: NanoTime.java    From parquet-mr with Apache License 2.0 4 votes vote down vote up
@Override
public void writeValue(RecordConsumer recordConsumer) {
  recordConsumer.addBinary(toBinary());
}
 
Example 5
Source File: Int96Value.java    From parquet-mr with Apache License 2.0 4 votes vote down vote up
@Override
public void writeValue(RecordConsumer recordConsumer) {
  recordConsumer.addBinary(value);
}
 
Example 6
Source File: PrimitiveType.java    From parquet-mr with Apache License 2.0 4 votes vote down vote up
@Override
public void addValueToRecordConsumer(RecordConsumer recordConsumer,
    ColumnReader columnReader) {
  recordConsumer.addBinary(columnReader.getBinary());
}
 
Example 7
Source File: PrimitiveType.java    From parquet-mr with Apache License 2.0 4 votes vote down vote up
@Override
public void addValueToRecordConsumer(RecordConsumer recordConsumer,
    ColumnReader columnReader) {
  recordConsumer.addBinary(columnReader.getBinary());
}
 
Example 8
Source File: PrimitiveType.java    From parquet-mr with Apache License 2.0 4 votes vote down vote up
@Override
public void addValueToRecordConsumer(RecordConsumer recordConsumer,
    ColumnReader columnReader) {
  recordConsumer.addBinary(columnReader.getBinary());
}