Class ArrowBufConstantDetection

java.lang.Object
org.elasticsearch.compute.data.arrow.ArrowBufConstantDetection

public final class ArrowBufConstantDetection extends Object
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 Type
    Method
    Description
    static boolean
    isUniform(org.apache.arrow.memory.ArrowBuf buf, int rowCount, int byteSize)
    Returns true when every byteSize-wide element in buf's first rowCount positions has identical bytes to position 0.
    static boolean
    isUniformBits(org.apache.arrow.memory.ArrowBuf buf, int bitCount)
    Returns true when every bit in buf's first bitCount positions is identical.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isUniform

      public static boolean isUniform(org.apache.arrow.memory.ArrowBuf buf, int rowCount, int byteSize)
      Returns true when every byteSize-wide element in buf's first rowCount positions has identical bytes to position 0. byteSize must 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)
      Returns true when every bit in buf's first bitCount positions is identical. Compares whole bytes against a uniform mask; the partial last byte (when bitCount % 8 != 0) is masked to ignore unused trailing bits.