Class AllocationHelper

java.lang.Object
org.apache.arrow.vector.AllocationHelper

public class AllocationHelper extends Object
Helper utility methods for allocating storage for Vectors.
  • Method Details

    • allocate

      public static void allocate(ValueVector v, int valueCount, int bytesPerValue)
      Allocates the vector.
      Parameters:
      v - The vector to allocate.
      valueCount - Number of values to allocate.
      bytesPerValue - bytes per value.
      Throws:
      OutOfMemoryException - if it can't allocate the memory.
    • allocatePrecomputedChildCount

      public static void allocatePrecomputedChildCount(ValueVector v, int valueCount, int bytesPerValue, int childValCount)
      Allocates memory for a vector assuming given number of values and their width.
      Parameters:
      v - The vector the allocate.
      valueCount - The number of elements to allocate.
      bytesPerValue - The bytes per value to use for allocating underlying storage
      childValCount - If v is a repeated vector, this is number of child elements to allocate.
      Throws:
      OutOfMemoryException - if it can't allocate the memory.
    • allocate

      public static void allocate(ValueVector v, int valueCount, int bytesPerValue, int repeatedPerTop)
      Allocates memory for a vector assuming given number of values and their width.
      Parameters:
      v - The vector the allocate.
      valueCount - The number of elements to allocate.
      bytesPerValue - The bytes per value to use for allocating underlying storage
      repeatedPerTop - If v is a repeated vector, this is assumed number of elements per child.
      Throws:
      OutOfMemoryException - if it can't allocate the memory
    • allocateNew

      public static void allocateNew(ValueVector v, int valueCount)
      Allocates the exact amount if v is fixed width, otherwise falls back to dynamic allocation.
      Parameters:
      v - value vector we are trying to allocate
      valueCount - size we are trying to allocate
      Throws:
      OutOfMemoryException - if it can't allocate the memory