Class CompoundOutputEval<T extends CompoundOutputEval<T>>

All Implemented Interfaces:
NamedWriteable, Writeable, PostAnalysisVerificationAware, TelemetryAware, Resolvable, GeneratingPlan<CompoundOutputEval<T>>, Streaming
Direct Known Subclasses:
RegisteredDomain, UriParts, UserAgent

public abstract class CompoundOutputEval<T extends CompoundOutputEval<T>> extends UnaryPlan implements TelemetryAware, GeneratingPlan<CompoundOutputEval<T>>, PostAnalysisVerificationAware, Streaming
Base class for logical plan nodes that make a single evaluation on a single input expression and produce multiple output columns.

NOTE: The construction of the initial instance of the CompoundOutputEval subclass computes the output attributes based on the specific evaluator's output columns and the provided prefix. Therefore, it should be used only when the node is first created. In order to ensure this, there is no constructor that makes this computation directly. Instead, the initial instance creation should be done through a static method like createInitialInstance(...) that makes use of the static computeOutputAttributes(java.util.SequencedMap<java.lang.String, java.lang.Class<?>>, java.lang.String, org.elasticsearch.xpack.esql.core.tree.Source) method. Any subsequent instance construction, such as deserialization, regeneration with new names, or child replacement, should use the constructor that directly accepts the output fields.

  • Field Details

    • input

      protected final Expression input
      The input by which the evaluation is performed.
  • Constructor Details

    • CompoundOutputEval

      protected CompoundOutputEval(Source source, LogicalPlan child, Expression input, List<String> outputFieldNames, List<Attribute> outputFieldAttributes)
      This constructor directly accepts the output fields. It should be used for deserialization, regeneration with new names, child replacement, or other scenarios where the output fields are already known.
      Parameters:
      source - the source information
      child - the child logical plan
      input - the input expression
      outputFieldAttributes - the output attributes
    • CompoundOutputEval

      protected CompoundOutputEval(StreamInput in) throws IOException
      This constructor is used for the deserialization of a CompoundOutputEval instance from a StreamInput. Subclasses should call this constructor from their own deserialization constructor.
      Parameters:
      in - the input stream to read from
      Throws:
      IOException - if an I/O error occurs
  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • computeOutputAttributes

      protected static List<Attribute> computeOutputAttributes(SequencedMap<String,Class<?>> outputColumns, String outputFieldPrefix, Source source)
      Computes the output attributes based on the provided output columns and prefix.
      Parameters:
      outputColumns - the output columns by which the output attributes should be named and typed
      outputFieldPrefix - the prefix to be used for the output field names
      source - the source information for the attributes
      Returns:
      a list of computed output attributes
    • createNewInstance

      public abstract T createNewInstance(Source source, LogicalPlan child, Expression input, List<String> outputFieldNames, List<Attribute> outputFieldAttributes)
      Creates a new instance of the specific CompoundOutputEval subclass with the provided parameters. Subclasses should call their corresponding constructor with the provided arguments and the concrete evaluator instance.
      Parameters:
      source - the source information
      child - the child logical plan
      input - the input expression
      outputFieldNames - the output field names, used for the computation of the output attributes
      outputFieldAttributes - the output attributes
      Returns:
      a new instance of the specific CompoundOutputEval subclass
    • getInput

      public Expression getInput()
    • outputFieldNames

      public List<String> outputFieldNames()
    • generatedAttributes

      public List<Attribute> generatedAttributes()
      Specified by:
      generatedAttributes in interface GeneratingPlan<T extends CompoundOutputEval<T>>
    • computeReferences

      protected AttributeSet computeReferences()
      By explicitly returning the references of the input expression, we implicitly exclude the generated fields from the references that require resolution.
      Overrides:
      computeReferences in class QueryPlan<LogicalPlan>
      Returns:
      only the input expression references
    • withGeneratedNames

      public T withGeneratedNames(List<String> newNames)
      Description copied from interface: GeneratingPlan
      Create a new instance of this node with new output Attributes using the given names. If an output attribute already has the desired name, we continue using it; otherwise, we create a new attribute with a new NameId.
      Specified by:
      withGeneratedNames in interface GeneratingPlan<T extends CompoundOutputEval<T>>
    • output

      public List<Attribute> output()
      Description copied from class: QueryPlan
      The ordered list of attributes (i.e. columns) this plan produces when executed. Must be called only on resolved plans, otherwise may throw an exception or return wrong results.
      Overrides:
      output in class UnaryPlan
    • replaceChild

      public T replaceChild(LogicalPlan newChild)
      Specified by:
      replaceChild in class UnaryPlan
    • expressionsResolved

      public boolean expressionsResolved()
      Specified by:
      expressionsResolved in class LogicalPlan
    • info

      protected NodeInfo<? extends LogicalPlan> info()
      Description copied from class: Node
      Normally, you want to use one of the static create methods to implement this.

      For QueryPlans, it is very important that the properties contain all of the expressions and references relevant to this node, and that all the properties are used in the provided constructor; otherwise query plan transformations like QueryPlan#transformExpressionsOnly(Function) will not have an effect.

      Specified by:
      info in class Node<LogicalPlan>
    • innerHashCode

      protected abstract int innerHashCode()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class UnaryPlan
    • innerEquals

      protected abstract boolean innerEquals(CompoundOutputEval<?> other)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class UnaryPlan