java.lang.Object
org.apache.arrow.memory.util.ByteFunctionHelpers
Utility methods for memory comparison at a byte level.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intcombineHash(int currentHash, int newHash) Generate a new hashCode with the given current hashCode and new hashCode.static intHelper function to compare a set of bytes in ArrowBuf to a ByteArray.static intHelper function to compare a set of bytes in two ArrowBufs.static intHelper function to check for equality of bytes in two ArrowBufs.static intCompute hashCode with the givenArrowBufand start/end index.static final inthash(ArrowBufHasher hasher, ArrowBuf buf, long start, long end) Compute hashCode with the givenArrowBufHasher,ArrowBufand start/end index.static intunsignedIntCompare(int a, int b) static intunsignedLongCompare(long a, long b) Compares the two specifiedlongvalues, treating them as unsigned values between0and2^64 - 1inclusive.
-
Method Details
-
equal
public static int equal(ArrowBuf left, long lStart, long lEnd, ArrowBuf right, long rStart, long rEnd) Helper function to check for equality of bytes in two ArrowBufs.- Parameters:
left- Left ArrowBuf for comparisonlStart- start offset in the bufferlEnd- end offset in the bufferright- Right ArrowBuf for comparisonrStart- start offset in the bufferrEnd- end offset in the buffer- Returns:
- 1 if equals, 0 otherwise
-
compare
public static int compare(ArrowBuf left, long lStart, long lEnd, ArrowBuf right, long rStart, long rEnd) Helper function to compare a set of bytes in two ArrowBufs.Function will check data before completing in the case that
- Parameters:
left- Left ArrowBuf to comparelStart- start offset in the bufferlEnd- end offset in the bufferright- Right ArrowBuf to comparerStart- start offset in the bufferrEnd- end offset in the buffer- Returns:
- 1 if left input is greater, -1 if left input is smaller, 0 otherwise
-
compare
Helper function to compare a set of bytes in ArrowBuf to a ByteArray.- Parameters:
left- Left ArrowBuf for comparison purposeslStart- start offset in the bufferlEnd- end offset in the bufferright- second input to be comparedrStart- start offset in the byte arrayrEnd- end offset in the byte array- Returns:
- 1 if left input is greater, -1 if left input is smaller, 0 otherwise
-
unsignedLongCompare
public static int unsignedLongCompare(long a, long b) Compares the two specifiedlongvalues, treating them as unsigned values between0and2^64 - 1inclusive.- Parameters:
a- the first unsignedlongto compareb- the second unsignedlongto compare- Returns:
- a negative value if
ais less thanb; a positive value ifais greater thanb; or zero if they are equal
-
unsignedIntCompare
public static int unsignedIntCompare(int a, int b) -
hash
Compute hashCode with the givenArrowBufand start/end index. -
hash
Compute hashCode with the givenArrowBufHasher,ArrowBufand start/end index. -
combineHash
public static int combineHash(int currentHash, int newHash) Generate a new hashCode with the given current hashCode and new hashCode.
-