Interface LongRangeBlock

All Superinterfaces:
org.apache.lucene.util.Accountable, AutoCloseable, Block, BlockLoader.Block, Closeable, RefCounted, Releasable, Writeable
All Known Implementing Classes:
ConstantNullBlock, LongRangeArrayBlock

public sealed interface LongRangeBlock extends Block permits LongRangeArrayBlock, ConstantNullBlock
Block that stores long ranges.
  • Method Details

    • isNull

      boolean isNull(int position)
      Specified by:
      isNull in interface Block
      Parameters:
      position - the position
      Returns:
      true if the value stored at the given position is null, false otherwise
    • filter

      LongRangeBlock filter(boolean mayContainDuplicates, int[] positions, int offset, int length)
      Description copied from interface: Block
      Creates a new block that only exposes the positions provided.
      Specified by:
      filter in interface Block
      Parameters:
      mayContainDuplicates - may the positions array contain duplicate positions?
      positions - the positions to retain
      offset - the start index in the positions array
      length - the number of positions to use from the array
      Returns:
      a filtered block
    • filter

      default LongRangeBlock filter(boolean mayContainDuplicates, int... positions)
      Description copied from interface: Block
      Creates a new block that only exposes the positions provided.
      Specified by:
      filter in interface Block
      Parameters:
      mayContainDuplicates - may the positions array contain duplicate positions?
      positions - the positions to retain
      Returns:
      a filtered block
    • keepMask

      LongRangeBlock 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

      ReleasableIterator<? extends LongRangeBlock> 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

      LongRangeBlock 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
    • equals

      static boolean equals(LongRangeBlock lhs, LongRangeBlock rhs)
      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 LongRangeBlock interface.
    • hash

      static int hash(LongRangeBlock block)
    • getFromBlock

      LongBlock getFromBlock()
    • getToBlock

      LongBlock getToBlock()
    • getLongRange

      LongRangeBlockBuilder.LongRange getLongRange(int valueIndex, LongRangeBlockBuilder.LongRange scratch)
      Returns the long range at the given value index, mutating scratch in place.
      Parameters:
      valueIndex - the value-offset (use Block.getFirstValueIndex(int) to translate from a position)
      scratch - the reusable container to populate
      Returns:
      scratch, populated with from/to for the value at valueIndex