Class Bucket
- All Implemented Interfaces:
NamedWriteable,Writeable,PostAnalysisPlanVerificationAware,PostOptimizationVerificationAware,Resolvable,EvaluatorMapper,TwoOptionalArguments
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.xpack.esql.expression.function.grouping.GroupingFunction
GroupingFunction.EvaluatableGroupingFunction, GroupingFunction.NonEvaluatableGroupingFunctionNested classes/interfaces inherited from class org.elasticsearch.xpack.esql.core.expression.Expression
Expression.TypeResolutionNested classes/interfaces inherited from interface org.elasticsearch.xpack.esql.evaluator.mapper.EvaluatorMapper
EvaluatorMapper.ToEvaluatorNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBucket(Source source, Expression field, Expression buckets, Expression from, Expression to) -
Method Summary
Modifier and TypeMethodDescriptionbuckets()dataType()field()booleanfoldable()from()protected NodeInfo<? extends Expression> info()voidpostOptimizationVerification(Failures failures) Validates the implementing expression - discovered failures are reported to the givenFailuresclass.replaceChildren(List<Expression> newChildren) protected Expression.TypeResolutionto()toEvaluator(EvaluatorMapper.ToEvaluator toEvaluator) Convert this into anEvalOperator.ExpressionEvaluator.toString()voidwriteTo(StreamOutput out) Methods inherited from class org.elasticsearch.xpack.esql.expression.function.grouping.GroupingFunction.EvaluatableGroupingFunction
foldMethods inherited from class org.elasticsearch.xpack.esql.expression.function.grouping.GroupingFunction
postAnalysisPlanVerificationMethods inherited from class org.elasticsearch.xpack.esql.core.expression.function.Function
arguments, equals, functionName, hashCode, nodeString, nullableMethods inherited from class org.elasticsearch.xpack.esql.core.expression.Expression
canonical, canonicalize, childrenResolved, propertiesToString, references, resolved, semanticEquals, semanticHash, typeResolvedMethods 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, replaceChildrenSameSize, source, sourceLocation, sourceText, 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.evaluator.mapper.EvaluatorMapper
fold
-
Field Details
-
ENTRY
-
-
Constructor Details
-
Bucket
-
-
Method Details
-
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
getWriteableName
- Specified by:
getWriteableNamein interfaceNamedWriteable
-
foldable
public boolean foldable()- Overrides:
foldablein classExpression
-
toEvaluator
public EvalOperator.ExpressionEvaluator.Factory toEvaluator(EvaluatorMapper.ToEvaluator toEvaluator) Description copied from interface:EvaluatorMapperConvert this into anEvalOperator.ExpressionEvaluator.Note for implementors: If you are implementing this function, you should call the passed-in lambda on your children, after doing any other manipulation (casting, etc.) necessary.
Note for Callers: If you are attempting to call this method, and you have an
Expressionand aLayout, you likely want to callEvalMapper.toEvaluator(org.elasticsearch.xpack.esql.core.expression.FoldContext, org.elasticsearch.xpack.esql.core.expression.Expression, org.elasticsearch.xpack.esql.planner.Layout)instead. On the other hand, if you already have something that looks like the parameter for this method, you should call this method with that function.Build an
EvalOperator.ExpressionEvaluator.Factoryfor the tree of expressions rooted at this node. This is only guaranteed to return a sensible evaluator if this node has a valid type. If this node is a subclass ofExpressionthen "valid type" means thatExpression.typeResolved()returns a non-error resolution. If Expression.typeResolved() returns an error then this method may throw. Or return an evaluator that produces garbage. Or return an evaluator that throws when run.- Specified by:
toEvaluatorin interfaceEvaluatorMapper
-
resolveType
- Overrides:
resolveTypein classExpression
-
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
-
dataType
- Specified by:
dataTypein classExpression
-
replaceChildren
- Specified by:
replaceChildrenin classNode<Expression>
-
info
- Specified by:
infoin classNode<Expression>
-
field
-
buckets
-
from
-
to
-
toString
- Overrides:
toStringin classExpression
-