Package org.apache.arrow.memory.util
Class ArrowBufPointer
java.lang.Object
org.apache.arrow.memory.util.ArrowBufPointer
- All Implemented Interfaces:
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 Summary
Modifier and TypeFieldDescriptionstatic final int
The hash code when the arrow buffer is null. -
Constructor Summary
ConstructorDescriptionThe default constructor.ArrowBufPointer
(ArrowBuf buf, long offset, long length) Constructs an Arrow buffer pointer.ArrowBufPointer
(ArrowBuf buf, long offset, long length, ArrowBufHasher hasher) Constructs an Arrow buffer pointer.ArrowBufPointer
(ArrowBufHasher hasher) Constructs an arrow buffer pointer with the specified hasher. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(ArrowBufPointer that) Compare two arrow buffer pointers.boolean
@Nullable ArrowBuf
getBuf()
Gets the underlying buffer, or null if the underlying data is invalid or null.long
long
int
hashCode()
void
Sets this pointer.
-
Field Details
-
NULL_HASH_CODE
public static final int NULL_HASH_CODEThe hash code when the arrow buffer is null.- See Also:
-
-
Constructor Details
-
ArrowBufPointer
public ArrowBufPointer()The default constructor. -
ArrowBufPointer
Constructs an arrow buffer pointer with the specified hasher.- Parameters:
hasher
- the hasher to use.
-
ArrowBufPointer
Constructs an Arrow buffer pointer.- Parameters:
buf
- the underlyingArrowBuf
, 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
Constructs an Arrow buffer pointer.- Parameters:
buf
- the underlyingArrowBuf
, 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
Sets this pointer.- Parameters:
buf
- the underlyingArrowBuf
, 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
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
-
hashCode
public int hashCode() -
compareTo
Compare two arrow buffer pointers. The comparison is based on lexicographic order.- Specified by:
compareTo
in interfaceComparable<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.
-