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

The following examples show how to use org.apache.parquet.io.api.RecordConsumer#addInteger() . 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: Int32DecimalParquetValueWriter.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) {
  byte[] output;
  int startPos;
  int length = end - start;
  startPos = Ints.BYTES - length;
  output = new byte[Ints.BYTES];
  if (startPos >= 0) {
    buffer.getBytes(start, output, startPos, length);
  } else {
    // in this case value from FIXED_LEN_BYTE_ARRAY or BINARY field was taken, ignore leading bytes
    buffer.getBytes(start - startPos, output, 0, length + startPos);
    startPos = 0;
  }
  if (output[startPos] < 0) {
    Arrays.fill(output, 0, output.length - length, (byte) -1);
  }
  consumer.addInteger(Ints.fromByteArray(output));
}
 
Example 2
Source File: IntegerValue.java    From parquet-mr with Apache License 2.0 4 votes vote down vote up
@Override
public void writeValue(RecordConsumer recordConsumer) {
  recordConsumer.addInteger(value);
}
 
Example 3
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.addInteger(columnReader.getInteger());
}