Class UnionAll
- All Implemented Interfaces:
NamedWriteable,Writeable,PostAnalysisPlanVerificationAware,PostOptimizationPlanVerificationAware,TelemetryAware,Resolvable,ExecutesOn,ExecutesOn.Coordinator
-
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.xpack.esql.plan.logical.ExecutesOn
ExecutesOn.Coordinator, ExecutesOn.ExecuteLocation, ExecutesOn.RemoteNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields inherited from class org.elasticsearch.xpack.esql.plan.logical.Fork
FORK_FIELD, MAX_BRANCHESFields inherited from class org.elasticsearch.xpack.esql.core.tree.Node
TO_STRING_MAX_WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()protected NodeInfo<? extends LogicalPlan> info()Allows the implementer to return a consumer that will perform self-validation in the context of the tree structure the implementer is part of.Validates the implementing expression - discovered failures are reported to the givenFailuresclass.replaceChildren(List<LogicalPlan> newChildren) replaceSubPlans(List<LogicalPlan> subPlans) replaceSubPlansAndOutput(List<LogicalPlan> subPlans, List<Attribute> output) Methods inherited from class org.elasticsearch.xpack.esql.plan.logical.Fork
expressionsResolved, getWriteableName, output, outputUnion, outputUnsupportedAttributeNames, writeToMethods inherited from class org.elasticsearch.xpack.esql.plan.logical.LogicalPlan
analyzed, childrenResolved, optimized, preAnalyzed, preOptimized, resolved, setAnalyzed, setOptimized, setPreAnalyzed, setPreOptimizedMethods 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, forEachDownMayReturnEarly, 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.plan.logical.ExecutesOn.Coordinator
executesOnMethods inherited from interface org.elasticsearch.xpack.esql.capabilities.TelemetryAware
telemetryLabel
-
Constructor Details
-
UnionAll
-
-
Method Details
-
replaceChildren
- Overrides:
replaceChildrenin classFork
-
info
-
replaceSubPlans
- Overrides:
replaceSubPlansin classFork
-
replaceSubPlansAndOutput
- Overrides:
replaceSubPlansAndOutputin classFork
-
hashCode
public int hashCode() -
equals
-
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- Overrides:
postAnalysisPlanVerificationin classFork- Returns:
- a consumer that will receive a tree to check and an accumulator of failures found during inspection.
-
postOptimizationPlanVerification
Description copied from interface:PostOptimizationPlanVerificationAwareValidates the implementing expression - discovered failures are reported to the givenFailuresclass.Example: the SORT command,
OrderBy, can only be executed currently if it can be associated with a LIMITLimitand together transformed into aTopN(which is executable). The replacement of the LIMIT+SORT into a TopN is done at the end of the optimization phase. This means that any SORT still existing in the plan post optimization is an error. However, there can be a LIMIT in the plan, but separated from the SORT by an INLINE STATS; in this case, the LIMIT cannot be pushed down near the SORT. To inform the user how they need to modify the query so it can be run, we implement this:@Override public BiConsumer<LogicalPlan, Failures> postOptimizationPlanVerification() { return (p, failures) -> { if (p instanceof InlineJoin inlineJoin) { inlineJoin.forEachUp(OrderBy.class, orderBy -> { failures.add( fail( inlineJoin, "unbounded SORT [{}] not supported before INLINE STATS [{}], move the sort after the INLINE STATS", orderBy.sourceText(), inlineJoin.sourceText() ) ); }); } else if (p instanceof OrderBy) { failures.add(fail(p, "Unbounded SORT not supported yet [{}] please add a LIMIT", p.sourceText())); } }; }If we didn't need to check the structure of the plan, it would have sufficed to implement the
PostOptimizationVerificationAwareinterface, which would simply check if there is an instance ofOrderByin the plan.- Specified by:
postOptimizationPlanVerificationin interfacePostOptimizationPlanVerificationAware- Returns:
- a consumer that will receive a tree to check and an accumulator of failures found during inspection.
-