Class CompoundOutputEvaluator

java.lang.Object
org.elasticsearch.xpack.esql.evaluator.command.CompoundOutputEvaluator
All Implemented Interfaces:
ColumnExtractOperator.Evaluator

public final class CompoundOutputEvaluator extends Object implements ColumnExtractOperator.Evaluator
The base evaluator that extracts compound output. Subclasses should implement the actual evaluation logic.
  • Field Details

  • Method Details

    • computeRow

      public void computeRow(BytesRefBlock input, int row, Block.Builder[] target, org.apache.lucene.util.BytesRef spare)
      Executes the evaluation of the corresponding function on the provided input. The target output array must have the same size as the functionOutputFields list that was provided in construction, and its elements must match this list's entries in type and order. Otherwise, this method will throw an exception. If an expected output field is missing from the actual output of the function, a null value will be appended to the corresponding target block. If the actual output of the function contains an entry that is not expected, it will be ignored.
      Specified by:
      computeRow in interface ColumnExtractOperator.Evaluator
      Parameters:
      input - the input to evaluate the function on
      row - row index in the input
      target - the output column blocks
      spare - the BytesRef to use for value retrieval
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • stringValueCollector

      public static BiConsumer<CompoundOutputEvaluator.RowOutput,String> stringValueCollector(int index)
    • intValueCollector

      public static ObjIntConsumer<CompoundOutputEvaluator.RowOutput> intValueCollector(int index, IntPredicate predicate)
      Creates a collector for primitive int values.
      Parameters:
      index - the index of the corresponding block in the target array
      predicate - the predicate to apply on the int value to determine whether to append it or a null
      Returns:
      a primitive int collector