All Implemented Interfaces:
NamedWriteable, Writeable, PostAnalysisPlanVerificationAware, TelemetryAware, Resolvable

public class Fork extends LogicalPlan implements PostAnalysisPlanVerificationAware, TelemetryAware
A Fork is a n-ary Plan where each child is a sub plan, e.g. FORK [WHERE content:"fox" ] [WHERE content:"dog"]
  • Field Details

  • Constructor Details

  • Method Details

    • replaceChildren

      public LogicalPlan replaceChildren(List<LogicalPlan> newChildren)
      Specified by:
      replaceChildren in class Node<LogicalPlan>
    • 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
    • expressionsResolved

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

      protected NodeInfo<? extends LogicalPlan> info()
      Specified by:
      info in class Node<LogicalPlan>
    • replaceSubPlans

      public Fork replaceSubPlans(List<LogicalPlan> subPlans)
    • 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.
      Specified by:
      output in class QueryPlan<LogicalPlan>
    • outputUnion

      public static List<Attribute> outputUnion(List<LogicalPlan> subplans)
    • outputUnsupportedAttributeNames

      public static Set<String> outputUnsupportedAttributeNames(List<LogicalPlan> subplans)
      Returns a list of attribute names that will need to have the @{code UNSUPPORTED} data type in FORK output. These are attributes that are either UNSUPPORTED or missing in each FORK branch. If two branches have the same attribute name, but only in one of them the data type is UNSUPPORTED, this constitutes data type conflict, and so this attribute name will not be returned by this function. Data type conflicts are later on checked in postAnalysisPlanVerification.
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class LogicalPlan
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in class LogicalPlan
    • 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.