Interface BooleanBlock

All Superinterfaces:
org.apache.lucene.util.Accountable, AutoCloseable, Block, BlockLoader.Block, Closeable, org.elasticsearch.core.RefCounted, org.elasticsearch.core.Releasable, Writeable
All Known Implementing Classes:
BooleanArrayBlock, BooleanBigArrayBlock, BooleanVectorBlock, ConstantNullBlock

public sealed interface BooleanBlock extends Block permits BooleanArrayBlock, BooleanVectorBlock, ConstantNullBlock, BooleanBigArrayBlock
Block that stores boolean values. This class is generated. Edit X-Block.java.st instead.
  • Method Details

    • getBoolean

      boolean getBoolean(int valueIndex)
      Retrieves the boolean value stored at the given value index.

      Values for a given position are between getFirstValueIndex(position) (inclusive) and getFirstValueIndex(position) + getValueCount(position) (exclusive).

      Parameters:
      valueIndex - the value index
      Returns:
      the data value (as a boolean)
    • asVector

      BooleanVector asVector()
      Description copied from interface: Block
      Returns an efficient dense single-value view of this block.. Null, if the block is not dense single-valued. That is, if mayHaveNulls returns true, or getTotalValueCount is not equal to getPositionCount.
      Specified by:
      asVector in interface Block
      Returns:
      an efficient dense single-value view of this block
    • toMask

      ToMask toMask()
      Convert this to a "mask" that's appropriate for passing to keepMask(org.elasticsearch.compute.data.BooleanVector). Null and multivalued positions will be converted to false.
    • filter

      BooleanBlock filter(int... positions)
      Description copied from interface: Block
      Creates a new block that only exposes the positions provided.
      Specified by:
      filter in interface Block
      Parameters:
      positions - the positions to retain
      Returns:
      a filtered block TODO: pass BlockFactory
    • keepMask

      BooleanBlock keepMask(BooleanVector mask)
      Description copied from interface: Block
      Build a Block with the same values as this Block, but replacing all values for which mask.getBooleanValue(position) returns false with null. The mask vector must be at least as long as this Block.
      Specified by:
      keepMask in interface Block
    • lookup

      org.elasticsearch.core.ReleasableIterator<? extends BooleanBlock> lookup(IntBlock positions, ByteSizeValue targetBlockSize)
      Description copied from interface: Block
      Builds an Iterator of new Blocks with the same Block.elementType() as this Block whose values are copied from positions in this Block. It has the same number of positions as the positions parameter.

      For example, if this block contained [a, b, [b, c]] and were called with the block [0, 1, 1, [1, 2]] then the result would be [a, b, b, [b, b, c]].

      This process produces count(this) * count(positions) values per positions which could be quite large. Instead of returning a single Block, this returns an Iterator of Blocks containing all of the promised values.

      The returned ReleasableIterator may retain a reference to the positions parameter. Close it to release those references.

      This block is built using the same BlockFactory as was used to build the positions parameter.

      Specified by:
      lookup in interface Block
    • expand

      BooleanBlock expand()
      Description copied from interface: Block
      Expand multivalued fields into one row per value. Returns the same block if there aren't any multivalued fields to expand. The returned block needs to be closed by the caller to release the block's resources.
      Specified by:
      expand in interface Block
    • readFrom

      static BooleanBlock readFrom(BlockStreamInput in) throws IOException
      Throws:
      IOException
    • writeTo

      default void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Block
      Writes only the data of the block to a stream output. This method should be used when the type of the block is known during reading.
      Specified by:
      writeTo in interface Block
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • equals

      boolean equals(Object obj)
      Compares the given object with this block for equality. Returns true if and only if the given object is a BooleanBlock, and both blocks are equal.
      Overrides:
      equals in class Object
    • hashCode

      int hashCode()
      Returns the hash code of this block, as defined by hash(BooleanBlock).
      Overrides:
      hashCode in class Object
    • equals

      static boolean equals(BooleanBlock block1, BooleanBlock block2)
      Returns true if the given blocks are equal to each other, otherwise false. Two blocks are considered equal if they have the same position count, and contain the same values (including absent null values) in the same order. This definition ensures that the equals method works properly across different implementations of the BooleanBlock interface.
    • hash

      static int hash(BooleanBlock block)
      Generates the hash code for the given block. The hash code is computed from the block's values. This ensures that block1.equals(block2) implies that block1.hashCode()==block2.hashCode() for any two blocks, block1 and block2, as required by the general contract of Object.hashCode().