Class Fork
java.lang.Object
org.elasticsearch.xpack.esql.core.tree.Node<LogicalPlan>
org.elasticsearch.xpack.esql.plan.QueryPlan<LogicalPlan>
org.elasticsearch.xpack.esql.plan.logical.LogicalPlan
org.elasticsearch.xpack.esql.plan.logical.Fork
- All Implemented Interfaces:
NamedWriteable,Writeable,PostAnalysisPlanVerificationAware,TelemetryAware,Resolvable
A Fork is a n-ary
Plan where each child is a sub plan, e.g.
FORK [WHERE content:"fox" ] [WHERE content:"dog"] -
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.xpack.esql.plan.logical.LogicalPlan
LogicalPlan.StageNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleaninthashCode()protected NodeInfo<? extends LogicalPlan> info()output()The ordered list of attributes (i.e.outputUnion(List<LogicalPlan> subplans) outputUnsupportedAttributeNames(List<LogicalPlan> subplans) Returns a list of attribute names that will need to have the @{code UNSUPPORTED} data type in FORK output.Allows the implementer to return a consumer that will perform self-validation in the context of the tree structure the implementer is part of.replaceChildren(List<LogicalPlan> newChildren) replaceSubPlans(List<LogicalPlan> subPlans) voidwriteTo(StreamOutput out) Methods inherited from class org.elasticsearch.xpack.esql.plan.logical.LogicalPlan
analyzed, childrenResolved, optimized, preAnalyzed, resolved, setAnalyzed, setOptimized, setPreAnalyzedMethods inherited from class org.elasticsearch.xpack.esql.plan.QueryPlan
computeExpressions, computeReferences, expressions, forEachExpression, forEachExpression, forEachExpressionDown, forEachExpressionUp, inputSet, outputSet, references, transformExpressionsDown, transformExpressionsDown, transformExpressionsOnly, transformExpressionsOnly, transformExpressionsOnlyUp, transformExpressionsUp, transformExpressionsUpMethods inherited from class org.elasticsearch.xpack.esql.core.tree.Node
anyMatch, children, collect, collectFirstChildren, collectLeaves, doCollectFirst, forEachDown, forEachDown, forEachProperty, forEachPropertyDown, forEachPropertyOnly, forEachPropertyUp, forEachUp, forEachUp, nodeName, nodeProperties, nodeString, propertiesToString, replaceChildrenSameSize, source, sourceLocation, sourceText, toString, transformChildren, transformDown, transformDown, transformDown, transformNodeProps, transformPropertiesDown, transformPropertiesOnly, transformPropertiesUp, transformUp, transformUp, transformUpMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xpack.esql.capabilities.TelemetryAware
telemetryLabel
-
Field Details
-
FORK_FIELD
- See Also:
-
MAX_BRANCHES
public static final int MAX_BRANCHES- See Also:
-
MIN_BRANCHES
public static final int MIN_BRANCHES- See Also:
-
-
Constructor Details
-
Fork
-
-
Method Details
-
replaceChildren
- Specified by:
replaceChildrenin classNode<LogicalPlan>
-
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
getWriteableName
- Specified by:
getWriteableNamein interfaceNamedWriteable
-
expressionsResolved
public boolean expressionsResolved()- Specified by:
expressionsResolvedin classLogicalPlan
-
info
- Specified by:
infoin classNode<LogicalPlan>
-
replaceSubPlans
-
output
Description copied from class:QueryPlanThe 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:
outputin classQueryPlan<LogicalPlan>
-
outputUnion
-
outputUnsupportedAttributeNames
Returns a list of attribute names that will need to have the @{code UNSUPPORTED} data type in FORK output. These are attributes that are eitherUNSUPPORTEDor missing in each FORK branch. If two branches have the same attribute name, but only in one of them the data type isUNSUPPORTED, this constitutes data type conflict, and so this attribute name will not be returned by this function. Data type conflicts are later on checked inpostAnalysisPlanVerification. -
hashCode
public int hashCode()- Specified by:
hashCodein classLogicalPlan
-
equals
- Specified by:
equalsin classLogicalPlan
-
postAnalysisPlanVerification
Description copied from interface:PostAnalysisPlanVerificationAwareAllows 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
GroupingFunctioninstance, which models a function to group documents to aggregate over, can only be used in the context of the STATS command, modeled by theAggregateclass. 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:
postAnalysisPlanVerificationin interfacePostAnalysisPlanVerificationAware- Returns:
- a consumer that will receive a tree to check and an accumulator of failures found during inspection.
-