Java Code Examples for org.apache.arrow.vector.FieldVector#getBufferSize()

The following examples show how to use org.apache.arrow.vector.FieldVector#getBufferSize() . 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: Block.java    From aws-athena-query-federation with Apache License 2.0 5 votes vote down vote up
/**
 * Calculates the current used size in 'bytes' for all Apache Arrow Buffers that comprise the row data for
 * this Block.
 *
 * @return The used bytes of row data in this Block.
 * @note This value is likley smaller than the actually memory held by this Block as it only counts the 'used' portion
 * of the pre-allocated Apache Arrow Buffers. It is generally safer to think about this value as the size of the Block
 * if you serialize it and thus is useful for controlling the size of the Block responses sent to Athena.
 */
@Transient
public long getSize()
{
    long size = 0;
    for (FieldVector next : vectorSchema.getFieldVectors()) {
        size += next.getBufferSize();
    }
    return size;
}
 
Example 2
Source File: BaseSingleAccumulator.java    From dremio-oss with Apache License 2.0 3 votes vote down vote up
/**
 * Used to get the size of target accumulator vector
 * that stores the computed values. Arrow code
 * already has a way to get the exact size (in bytes)
 * from a vector by looking at the value count and type
 * of the vector. The returned size accounts both
 * validity and data buffers in the vector.
 *
 * We use this method when computing the size
 * of {@link VectorizedHashAggPartition} as part
 * of choosing a victim partition.
 *
 * @return size of vector (in bytes)
 */
@Override
public long getSizeInBytes() {
  long size = 0;
  for (int i = 0; i < batches; i++) {
    final FieldVector accumulatorVector = accumulators[i];
    size += accumulatorVector.getBufferSize();
  }
  return size;
}