Enum Class BlockOptimization

java.lang.Object
java.lang.Enum<BlockOptimization>
org.elasticsearch.compute.operator.lookup.BlockOptimization
All Implemented Interfaces:
Serializable, Comparable<BlockOptimization>, Constable

public enum BlockOptimization extends Enum<BlockOptimization>
Represents the optimization state for block processing in lookup/enrich operations.
  • Enum Constant Details

    • NONE

      public static final BlockOptimization NONE
      No optimization - used for LOOKUP JOIN where pages are not merged.

      When mergePages is false (e.g., LOOKUP JOIN), the lookup service returns multiple pages that are joined by RightChunkedLeftJoin rather than merged by MergePositionsOperator.

    • DICTIONARY

      public static final BlockOptimization DICTIONARY
      Dictionary optimization - input block has ordinals (dictionary-encoded), allowing query deduplication.

      For ENRICH operations, the input page contains exactly one block: the match field values. When this block is dictionary-encoded (OrdinalBytesRefBlock), we can optimize by:

      • EnrichQuerySourceOperator: queries only the unique dictionary values instead of all positions, avoiding duplicate queries for repeated match values.
      • MergePositionsOperator: uses the ordinals to map query results back to original positions, expanding the deduplicated results to match the input page's position count.
    • RANGE

      public static final BlockOptimization RANGE
      Range optimization - no deduplication, positions map 1:1 to input.

      Used when the input block is not dictionary-encoded (e.g., non-BytesRef types or BytesRef without ordinals). Each input position generates a separate query, and MergePositionsOperator uses a simple range [0, positionCount) to map results directly back to input positions without any expansion.

  • Method Details

    • values

      public static BlockOptimization[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static BlockOptimization valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • extractOrdinalBlock

      public static OrdinalBytesRefBlock extractOrdinalBlock(Page page)
      Extracts the OrdinalBytesRefBlock from block 0 of the given page. Used when in DICTIONARY optimization mode to access ordinals and dictionary.