Class DefaultTimeSeriesAggregateFunction
- All Implemented Interfaces:
NamedWriteable,Writeable,PostAnalysisPlanVerificationAware,Resolvable,OptionalArgument,SurrogateExpression
The purpose of this class is to provide a better type resolution error message for implicit time-series aggregations. It avoids having to change the source text of the field expression, which would be more invasive.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.xpack.esql.core.expression.Expression
Expression.TypeResolutionNested classes/interfaces inherited from class org.elasticsearch.xpack.esql.core.tree.Node
Node.NodeStringFormatNested 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.expression.function.aggregate.AggregateFunction
NO_WINDOW, WINDOW_INTERVALFields inherited from class org.elasticsearch.xpack.esql.core.tree.Node
TO_STRING_MAX_LINES, TO_STRING_MAX_WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionDefaultTimeSeriesAggregateFunction(Expression field, Expression timestamp) DefaultTimeSeriesAggregateFunction(Source source, Expression field, Expression filter, Expression window, Expression timestamp) -
Method Summary
Modifier and TypeMethodDescriptionbooleandataType()TheDataTypereturned by executing the tree rooted at this expression.protected NodeInfo<DefaultTimeSeriesAggregateFunction> info()Normally, you want to use one of the staticcreatemethods to implement this.Returns the aggregation function to be used in the first aggregation stage, which is grouped by `_tsid` (and `time_bucket`).replaceChildren(List<Expression> newChildren) The implementation ofExpression.typeResolved(), which is just a caching wrapper around this method.Returns the expression to be replaced by ornullif this cannot be replaced.toString()withFilter(Expression filter) Attach a filter to the aggregate function.Methods inherited from class org.elasticsearch.xpack.esql.expression.function.aggregate.TimeSeriesAggregateFunction
aggregateInputReferences, requiredTimeSeriesSourceMethods inherited from class org.elasticsearch.xpack.esql.expression.function.aggregate.AggregateFunction
equals, field, filter, hasFilter, hashCode, hasWindow, parameters, postAnalysisPlanVerification, readWindow, window, withField, withFilter, withFilter, withParameters, withWindow, writeToMethods inherited from class org.elasticsearch.xpack.esql.core.expression.function.Function
arguments, functionName, nodeString, nullableMethods inherited from class org.elasticsearch.xpack.esql.core.expression.Expression
canonical, canonicalize, fold, foldable, propertiesToString, references, resolved, semanticEquals, semanticHash, toString, typeResolvedMethods 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, replaceChildrenSameSize, source, sourceLocation, sourceText, transformChildren, transformChildren, transformDown, transformDown, transformDown, transformDown, transformDownSkipBranch, transformNodeProps, transformPropertiesDown, transformPropertiesOnly, transformPropertiesUp, transformUp, transformUp, transformUp
-
Constructor Details
-
DefaultTimeSeriesAggregateFunction
-
DefaultTimeSeriesAggregateFunction
public DefaultTimeSeriesAggregateFunction(Source source, Expression field, Expression filter, Expression window, Expression timestamp)
-
-
Method Details
-
perTimeSeriesAggregation
Description copied from class:TimeSeriesAggregateFunctionReturns the aggregation function to be used in the first aggregation stage, which is grouped by `_tsid` (and `time_bucket`).- Specified by:
perTimeSeriesAggregationin classTimeSeriesAggregateFunction- See Also:
-
withFilter
Description copied from class:AggregateFunctionAttach a filter to the aggregate function.- Specified by:
withFilterin classAggregateFunction
-
dataType
Description copied from class:ExpressionTheDataTypereturned by executing the tree rooted at this expression. IfExpression.typeResolved()returns an error then the behavior of this method is undefined. It may return a valid type. Or it may throw an exception. Or it may return a totally nonsensical type.- Specified by:
dataTypein classExpression
-
replaceChildren
- Specified by:
replaceChildrenin classNode<Expression>
-
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<Expression>
-
getWriteableName
- Specified by:
getWriteableNamein interfaceNamedWriteable
-
resolveType
Description copied from class:ExpressionThe implementation ofExpression.typeResolved(), which is just a caching wrapper around this method. See it's javadoc for what this method should return.Implementations will rarely interact with the
Expression.TypeResolutionclass directly, instead usually calling the utility methods onTypeResolutions.Implementations should fail if
Expression.childrenResolved()returnsfalse.- Overrides:
resolveTypein classAggregateFunction
-
surrogate
Description copied from interface:SurrogateExpressionReturns the expression to be replaced by ornullif this cannot be replaced.- Specified by:
surrogatein interfaceSurrogateExpression
-
toString
- Overrides:
toStringin classExpression
-
childrenResolved
public boolean childrenResolved()- Overrides:
childrenResolvedin classExpression
-