Class TimeSeriesCollapse
- All Implemented Interfaces:
NamedWriteable,Writeable,PostOptimizationVerificationAware,Resolvable
step and value columns become sparse, positionally-aligned multi-valued
columns; the dimensions stay single-valued grouping keys.
The parser stacks this node directly on top of a PromqlCommand when the user writes
TS_COLLAPSE (and the Prometheus query_range plan builder does the same so
PrometheusQueryResponseListener can read one MV row per series). The start,
end and stepBucketSize bounds are null at parse time and are filled in
by TranslateTimeSeriesCollapse
reading from the source PromqlCommand child; this avoids the divergence that would arise
from resolving them independently from the PROMQL evaluation. They stay as ESQL expressions all
the way down to the Mapper, which folds them to long when building the physical
TimeSeriesCollapseExec.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.xpack.esql.plan.logical.LogicalPlan
LogicalPlan.StageNested classes/interfaces inherited from class org.elasticsearch.xpack.esql.core.tree.Node
Node.NodeStringFormatNested classes/interfaces inherited from interface org.elasticsearch.xpack.esql.capabilities.PostOptimizationVerificationAware
PostOptimizationVerificationAware.CoordinatorOnlyNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NamedWriteableRegistry.Entrystatic final TransportVersionMinimum transport version that knows how to deserialize this plan node.Fields inherited from class org.elasticsearch.xpack.esql.core.tree.Node
TO_STRING_MAX_LINES, TO_STRING_MAX_WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionTimeSeriesCollapse(Source source, LogicalPlan child, Attribute value, Attribute step, List<Attribute> dimensions) Parse-time constructor; bounds are populated later byTranslateTimeSeriesCollapse.TimeSeriesCollapse(Source source, LogicalPlan child, Attribute value, Attribute step, List<Attribute> dimensions, Literal start, Literal end, Expression stepBucketSize) -
Method Summary
Modifier and TypeMethodDescriptionprotected AttributeSetThis very likely needs to be overridden forQueryPlan.references()to be correct when inheriting.longend()booleanbooleaninthashCode()protected NodeInfo<? extends LogicalPlan> info()Normally, you want to use one of the staticcreatemethods to implement this.static booleanisZeroLimit(LogicalPlan plan) output()The ordered list of attributes (i.e.voidpostOptimizationVerification(Failures failures) Validates the implementing expression - discovered failures are reported to the givenFailuresclass.replaceChild(LogicalPlan newChild) longstart()step()longvalue()voidvoidwriteTo(StreamOutput out) Methods inherited from class org.elasticsearch.xpack.esql.plan.logical.UnaryPlan
child, inputSet, outputSet, replaceChildrenMethods 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, expressions, forEachExpression, forEachExpression, forEachExpressionDown, forEachExpressionUp, references, transformExpressionsDown, transformExpressionsDown, transformExpressionsOnly, transformExpressionsOnly, transformExpressionsOnlyUp, transformExpressionsUp, transformExpressionsUpMethods inherited from class org.elasticsearch.xpack.esql.core.tree.Node
allMatch, anyMatch, children, collect, collect, collect, collectFirstChildren, collectLeaves, doCollectFirst, forEachDown, forEachDown, forEachDownMayReturnEarly, forEachProperty, forEachPropertyDown, forEachPropertyOnly, forEachPropertyUp, forEachUp, forEachUp, nodeName, nodeProperties, nodeString, nodeString, propertiesToString, replaceChildrenSameSize, source, sourceLocation, sourceText, toString, toString, toString, transformChildren, transformChildren, transformDown, transformDown, transformDown, transformDown, transformDownSkipBranch, transformNodeProps, transformPropertiesDown, transformPropertiesOnly, transformPropertiesUp, transformUp, transformUp, transformUp
-
Field Details
-
ENTRY
-
TS_COLLAPSE
Minimum transport version that knows how to deserialize this plan node.
-
-
Constructor Details
-
TimeSeriesCollapse
public TimeSeriesCollapse(Source source, LogicalPlan child, Attribute value, Attribute step, List<Attribute> dimensions) Parse-time constructor; bounds are populated later byTranslateTimeSeriesCollapse. -
TimeSeriesCollapse
public TimeSeriesCollapse(Source source, LogicalPlan child, Attribute value, Attribute step, List<Attribute> dimensions, Literal start, Literal end, Expression stepBucketSize)
-
-
Method Details
-
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
getWriteableName
- Specified by:
getWriteableNamein interfaceNamedWriteable
-
value
-
step
-
dimensions
-
startLiteral
-
endLiteral
-
stepBucketSize
-
start
public long start() -
end
public long end() -
stepMillis
public long stepMillis() -
computeReferences
Description copied from class:QueryPlanThis very likely needs to be overridden forQueryPlan.references()to be correct when inheriting. This can be called on unresolved plans and therefore must not rely on calls toQueryPlan.output().- Overrides:
computeReferencesin classQueryPlan<LogicalPlan>
-
expressionsResolved
public boolean expressionsResolved()- Specified by:
expressionsResolvedin classLogicalPlan
-
replaceChild
- Specified by:
replaceChildin classUnaryPlan
-
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. -
info
Description copied from class:NodeNormally, you want to use one of the staticcreatemethods 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 likeQueryPlan#transformExpressionsOnly(Function)will not have an effect.- Specified by:
infoin classNode<LogicalPlan>
-
verify
-
isZeroLimit
-
postOptimizationVerification
Description copied from interface:PostOptimizationVerificationAwareValidates the implementing expression - discovered failures are reported to the givenFailuresclass.Example: the
Bucketfunction, which produces buckets over a numerical or date field, based on a number of literal arguments needs to check if its arguments are all indeed literals. This is how this verification is performed:@Override public void postOptimizationVerification(Failures failures) { String operation = sourceText(); failures.add(isFoldable(buckets, operation, SECOND)) .add(from != null ? isFoldable(from, operation, THIRD) : null) .add(to != null ? isFoldable(to, operation, FOURTH) : null); }- Specified by:
postOptimizationVerificationin interfacePostOptimizationVerificationAware
-
hashCode
public int hashCode() -
equals
-