All Implemented Interfaces:
NamedWriteable, Writeable, PostAnalysisPlanVerificationAware, PostAnalysisVerificationAware, TelemetryAware, Resolvable, GeneratingPlan<Enrich>, SortAgnostic

  • Field Details

  • Constructor Details

  • Method Details

    • writeTo

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

      public String getWriteableName()
      Specified by:
      getWriteableName in interface NamedWriteable
    • matchField

      public NamedExpression matchField()
    • enrichFields

      public List<NamedExpression> enrichFields()
    • policy

      public EnrichPolicy policy()
    • concreteIndices

      public Map<String,String> concreteIndices()
    • policyName

      public Expression policyName()
    • mode

      public Enrich.Mode mode()
    • computeReferences

      protected AttributeSet computeReferences()
      Description copied from class: QueryPlan
      This very likely needs to be overridden for QueryPlan.references() to be correct when inheriting. This can be called on unresolved plans and therefore must not rely on calls to QueryPlan.output().
      Overrides:
      computeReferences in class QueryPlan<LogicalPlan>
    • expressionsResolved

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

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

      protected NodeInfo<? extends LogicalPlan> info()
      Specified by:
      info in class Node<LogicalPlan>
    • 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
    • generatedAttributes

      public List<Attribute> generatedAttributes()
      Specified by:
      generatedAttributes in interface GeneratingPlan<Enrich>
    • withGeneratedNames

      public Enrich 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<Enrich>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class UnaryPlan
    • hashCode

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

      public BiConsumer<LogicalPlan,Failures> postAnalysisPlanVerification()
      Description copied from interface: PostAnalysisPlanVerificationAware
      Allows the implementer to return a consumer that will perform self-validation in the context of the tree structure the implementer is part of. This usually involves checking the type and configuration of the children or that of the parent.

      It is often more useful to perform the checks as extended as it makes sense, over stopping at the first failure. This will allow the author to progress faster to a correct query.

      Example: a GroupingFunction instance, which models a function to group documents to aggregate over, can only be used in the context of the STATS command, modeled by the Aggregate class. This is how this verification is performed:

           
            @Override
            public BiConsumer<LogicalPlan, Failures> postAnalysisPlanVerification() {
                return (p, failures) -> {
                    if (p instanceof Aggregate == false) {
                        p.forEachExpression(
                            GroupingFunction.class,
                            gf -> failures.add(fail(gf, "cannot use grouping function [{}] outside of a STATS command", gf.sourceText()))
                        );
                    }
                };
            }
           
           
      Specified by:
      postAnalysisPlanVerification in interface PostAnalysisPlanVerificationAware
      Returns:
      a consumer that will receive a tree to check and an accumulator of failures found during inspection.
    • postAnalysisVerification

      public void postAnalysisVerification(Failures failures)
      Description copied from interface: PostAnalysisVerificationAware
      Allows the implementer to validate itself. This usually involves checking its internal setup, which often means checking the parameters it received on construction: their data or syntactic type, class, their count, expressions' structure etc. The discovered failures are added to the given Failures object.

      It is often more useful to perform the checks as extended as it makes sense, over stopping at the first failure. This will allow the author to progress faster to a correct query.

      Example: the Filter class, which models the WHERE command, checks that the expression it filters on - condition - is of a Boolean or NULL type:

           
           @Override
           void postAnalysisVerification(Failures failures) {
                if (condition.dataType() != NULL && condition.dataType() != BOOLEAN) {
                    failures.add(fail(condition, "Condition expression needs to be boolean, found [{}]", condition.dataType()));
                }
           }
           
           
      Specified by:
      postAnalysisVerification in interface PostAnalysisVerificationAware
      Parameters:
      failures - the object to add failures to.