Module org.elasticsearch.compute
Class ArrowBufConstantDetection
java.lang.Object
org.elasticsearch.compute.data.arrow.ArrowBufConstantDetection
Raw-buffer uniformity checks shared by
*ArrowBufBlock.of() factories to detect
constant-valued column batches before constructing a zero-copy block.
All checks short-circuit on the first differing value. Comparison is on raw buffer bits, which is correct for primitive equality and avoids NaN-equality pitfalls (different NaN bit patterns are correctly seen as different).
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisUniform(org.apache.arrow.memory.ArrowBuf buf, int rowCount, int byteSize) Returnstruewhen everybyteSize-wide element inbuf's firstrowCountpositions has identical bytes to position 0.static booleanisUniformBits(org.apache.arrow.memory.ArrowBuf buf, int bitCount) Returnstruewhen every bit inbuf's firstbitCountpositions is identical.
-
Method Details
-
isUniform
public static boolean isUniform(org.apache.arrow.memory.ArrowBuf buf, int rowCount, int byteSize) Returnstruewhen everybyteSize-wide element inbuf's firstrowCountpositions has identical bytes to position 0.byteSizemust be 1, 2, 4, or 8 (the fixed widths used by Arrow primitive vectors). -
isUniformBits
public static boolean isUniformBits(org.apache.arrow.memory.ArrowBuf buf, int bitCount) Returnstruewhen every bit inbuf's firstbitCountpositions is identical. Compares whole bytes against a uniform mask; the partial last byte (whenbitCount % 8 != 0) is masked to ignore unused trailing bits.
-