Class Sum
java.lang.Object
org.elasticsearch.xpack.esql.core.tree.Node<Expression>
org.elasticsearch.xpack.esql.core.expression.Expression
org.elasticsearch.xpack.esql.core.expression.function.Function
org.elasticsearch.xpack.esql.expression.function.aggregate.AggregateFunction
org.elasticsearch.xpack.esql.expression.function.aggregate.NumericAggregate
org.elasticsearch.xpack.esql.expression.function.aggregate.Sum
- All Implemented Interfaces:
NamedWriteable,Writeable,PostAnalysisPlanVerificationAware,Resolvable,AggregateMetricDoubleNativeSupport,SurrogateExpression,ToAggregator
public class Sum
extends NumericAggregate
implements SurrogateExpression, AggregateMetricDoubleNativeSupport
Sum all values of a field in matching documents.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.xpack.esql.core.expression.Expression
Expression.TypeResolutionNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsFields 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_WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionSum(Source source, Expression field) Sum(Source source, Expression field, Expression filter, Expression window, Expression summationMode) -
Method Summary
Modifier and TypeMethodDescriptiondataType()TheDataTypereturned by executing the tree rooted at this expression.protected AggregatorFunctionSupplierinfo()Normally, you want to use one of the staticcreatemethods to implement this.protected AggregatorFunctionSupplierprotected AggregatorFunctionSupplierreplaceChildren(List<Expression> newChildren) protected Expression.TypeResolutionThe implementation ofExpression.typeResolved(), which is just a caching wrapper around this method.Returns the expression to be replaced by ornullif this cannot be replaced.withFilter(Expression filter) Attach a filter to the aggregate function.Methods inherited from class org.elasticsearch.xpack.esql.expression.function.aggregate.NumericAggregate
supplier, supportsDatesMethods inherited from class org.elasticsearch.xpack.esql.expression.function.aggregate.AggregateFunction
aggregateInputReferences, equals, field, filter, hasFilter, hashCode, hasWindow, parameters, postAnalysisPlanVerification, readWindow, window, withParameters, 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, childrenResolved, fold, foldable, propertiesToString, references, resolved, semanticEquals, semanticHash, toString, typeResolvedMethods inherited from class org.elasticsearch.xpack.esql.core.tree.Node
anyMatch, children, collect, collect, collect, collectFirstChildren, collectLeaves, doCollectFirst, forEachDown, forEachDown, forEachDownMayReturnEarly, forEachProperty, forEachPropertyDown, forEachPropertyOnly, forEachPropertyUp, forEachUp, forEachUp, nodeName, nodeProperties, replaceChildrenSameSize, source, sourceLocation, sourceText, transformChildren, transformDown, transformDown, transformDown, transformNodeProps, transformPropertiesDown, transformPropertiesOnly, transformPropertiesUp, transformUp, transformUp, transformUp
-
Field Details
-
ENTRY
-
-
Constructor Details
-
Sum
-
Sum
public Sum(Source source, Expression field, Expression filter, Expression window, Expression summationMode)
-
-
Method Details
-
getWriteableName
- Specified by:
getWriteableNamein interfaceNamedWriteable
-
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>
-
replaceChildren
- Specified by:
replaceChildrenin classNode<Expression>
-
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.- Overrides:
dataTypein classNumericAggregate
-
longSupplier
- Specified by:
longSupplierin classNumericAggregate
-
intSupplier
- Specified by:
intSupplierin classNumericAggregate
-
doubleSupplier
- Specified by:
doubleSupplierin classNumericAggregate
-
summationMode
-
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 classNumericAggregate
-
surrogate
Description copied from interface:SurrogateExpressionReturns the expression to be replaced by ornullif this cannot be replaced.- Specified by:
surrogatein interfaceSurrogateExpression
-