Class ArrowBufPointer

java.lang.Object
org.apache.arrow.memory.util.ArrowBufPointer
All Implemented Interfaces:
Comparable<ArrowBufPointer>

public final class ArrowBufPointer extends Object implements Comparable<ArrowBufPointer>
Pointer to a memory region within an ArrowBuf. It will be used as the basis for calculating hash code within a vector, and equality determination.
  • Field Details

    • NULL_HASH_CODE

      public static final int NULL_HASH_CODE
      The hash code when the arrow buffer is null.
      See Also:
  • Constructor Details

    • ArrowBufPointer

      public ArrowBufPointer()
      The default constructor.
    • ArrowBufPointer

      public ArrowBufPointer(ArrowBufHasher hasher)
      Constructs an arrow buffer pointer with the specified hasher.
      Parameters:
      hasher - the hasher to use.
    • ArrowBufPointer

      public ArrowBufPointer(ArrowBuf buf, long offset, long length)
      Constructs an Arrow buffer pointer.
      Parameters:
      buf - the underlying ArrowBuf, which can be null.
      offset - the start off set of the memory region pointed to.
      length - the length off set of the memory region pointed to.
    • ArrowBufPointer

      public ArrowBufPointer(ArrowBuf buf, long offset, long length, ArrowBufHasher hasher)
      Constructs an Arrow buffer pointer.
      Parameters:
      buf - the underlying ArrowBuf, which can be null.
      offset - the start off set of the memory region pointed to.
      length - the length off set of the memory region pointed to.
      hasher - the hasher used to calculate the hash code.
  • Method Details

    • set

      public void set(ArrowBuf buf, long offset, long length)
      Sets this pointer.
      Parameters:
      buf - the underlying ArrowBuf, which can be null.
      offset - the start off set of the memory region pointed to.
      length - the length off set of the memory region pointed to.
    • getBuf

      public @Nullable ArrowBuf getBuf()
      Gets the underlying buffer, or null if the underlying data is invalid or null.
      Returns:
      the underlying buffer, if any, or null if the underlying data is invalid or null.
    • getOffset

      public long getOffset()
    • getLength

      public long getLength()
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(ArrowBufPointer that)
      Compare two arrow buffer pointers. The comparison is based on lexicographic order.
      Specified by:
      compareTo in interface Comparable<ArrowBufPointer>
      Parameters:
      that - the other pointer to compare.
      Returns:
      0 if the two pointers are equal; a positive integer if this pointer is larger; a negative integer if this pointer is smaller.