Java Code Examples for io.netty.buffer.ArrowBuf#getInt()

The following examples show how to use io.netty.buffer.ArrowBuf#getInt() . 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: ArrowSchemaConverter.java    From spark-bigquery-connector with Apache License 2.0 6 votes vote down vote up
@Override
final UTF8String getUTF8String(int rowId) {
  accessor.get(rowId, stringResult);
  if (stringResult.isSet == 0) {
    return null;
  } else {
    ArrowBuf offsets = accessor.getOffsetBuffer();
    int index = rowId * VarCharVector.OFFSET_WIDTH;
    int start = offsets.getInt(index);
    int end = offsets.getInt(index + VarCharVector.OFFSET_WIDTH);

    /* Since the result is accessed lazily if the memory address is corrupted we
     * might lose the data. Might be better to include a byte array. Not doing so
     * for performance reasons.
     */
    return UTF8String.fromAddress(/* base = */null,
        stringResult.buffer.memoryAddress() + start,
        end - start);
  }
}
 
Example 2
Source File: ArrowSchemaConverter.java    From spark-bigquery-connector with Apache License 2.0 5 votes vote down vote up
@Override
final ColumnarArray getArray(int rowId) {
  ArrowBuf offsets = accessor.getOffsetBuffer();
  int index = rowId * ListVector.OFFSET_WIDTH;
  int start = offsets.getInt(index);
  int end = offsets.getInt(index + ListVector.OFFSET_WIDTH);
  return new ColumnarArray(arrayData, start, end - start);
}
 
Example 3
Source File: FlightArrowColumnVector.java    From flight-spark-source with Apache License 2.0 5 votes vote down vote up
@Override
final ColumnarArray getArray(int rowId) {
  ArrowBuf offsets = accessor.getOffsetBuffer();
  int index = rowId * ListVector.OFFSET_WIDTH;
  int start = offsets.getInt(index);
  int end = offsets.getInt(index + ListVector.OFFSET_WIDTH);
  return new ColumnarArray(arrayData, start, end - start);
}
 
Example 4
Source File: ArrowVectorAccessors.java    From iceberg with Apache License 2.0 5 votes vote down vote up
@Override
final ColumnarArray getArray(int rowId) {
  ArrowBuf offsets = vector.getOffsetBuffer();
  int index = rowId * ListVector.OFFSET_WIDTH;
  int start = offsets.getInt(index);
  int end = offsets.getInt(index + ListVector.OFFSET_WIDTH);
  return new ColumnarArray(arrayData, start, end - start);
}