Class Sample
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.Sample
- All Implemented Interfaces:
NamedWriteable,Writeable,PostAnalysisPlanVerificationAware,PostOptimizationVerificationAware,Resolvable,ToAggregator
public class Sample
extends AggregateFunction
implements ToAggregator, PostOptimizationVerificationAware
-
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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSample(Source source, Expression field, Expression limit) Sample(Source source, Expression field, Expression filter, Expression limit) Sample(Source source, Expression field, Expression filter, Expression limit, Expression uuid) The query "FROM data | STATS s1=SAMPLE(x,N), s2=SAMPLE(x,N)" should give two different samples of size N. -
Method Summary
Modifier and TypeMethodDescriptiondataType()info()voidpostOptimizationVerification(Failures failures) Validates the implementing expression - discovered failures are reported to the givenFailuresclass.replaceChildren(List<Expression> newChildren) protected Expression.TypeResolutionsupplier()withFilter(Expression filter) Attach a filter to the aggregate function.Methods inherited from class org.elasticsearch.xpack.esql.expression.function.aggregate.AggregateFunction
deprecatedWriteParams, equals, field, filter, hasFilter, hashCode, parameters, postAnalysisPlanVerification, readGenericAggregateFunction, 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, 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
-
Sample
-
Sample
-
Sample
public Sample(Source source, Expression field, Expression filter, Expression limit, Expression uuid) The query "FROM data | STATS s1=SAMPLE(x,N), s2=SAMPLE(x,N)" should give two different samples of size N. The uuid is used to ensure that the optimizer does not optimize both expressions to one, resulting in identical samples.
-
-
Method Details
-
resolveType
- Overrides:
resolveTypein classAggregateFunction
-
getWriteableName
- Specified by:
getWriteableNamein interfaceNamedWriteable
-
dataType
- Specified by:
dataTypein classExpression
-
info
- Specified by:
infoin classNode<Expression>
-
replaceChildren
- Specified by:
replaceChildrenin classNode<Expression>
-
supplier
- Specified by:
supplierin interfaceToAggregator
-
withFilter
Description copied from class:AggregateFunctionAttach a filter to the aggregate function.- Specified by:
withFilterin classAggregateFunction
-
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
-