Class Categorize
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.grouping.GroupingFunction
org.elasticsearch.xpack.esql.expression.function.grouping.GroupingFunction.NonEvaluatableGroupingFunction
org.elasticsearch.xpack.esql.expression.function.grouping.Categorize
- All Implemented Interfaces:
NamedWriteable,Writeable,PostAnalysisPlanVerificationAware,Resolvable,OptionalArgument,LicenseAware
public class Categorize
extends GroupingFunction.NonEvaluatableGroupingFunction
implements OptionalArgument, LicenseAware
Categorizes text messages.
This function has no evaluators, as it works like an aggregation (Accumulates values, stores intermediate states, etc).
For the implementation, see CategorizeBlockHash
-
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.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondataType()field()booleanfoldable()protected NodeInfo<? extends Expression> info()booleanlicenseCheck(XPackLicenseState state) Return true if the implementer can be executed under the providedXPackLicenseState, otherwise false.nullable()Allows the implementer to return a consumer that will perform self-validation in the context of the tree structure the implementer is part of.replaceChildren(List<Expression> newChildren) protected Expression.TypeResolutiontoString()voidwriteTo(StreamOutput out) Methods inherited from class org.elasticsearch.xpack.esql.core.expression.function.Function
arguments, equals, functionName, hashCode, nodeStringMethods inherited from class org.elasticsearch.xpack.esql.core.expression.Expression
canonical, canonicalize, childrenResolved, fold, propertiesToString, references, resolved, semanticEquals, semanticHash, 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
-
Categorize
-
-
Method Details
-
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
getWriteableName
- Specified by:
getWriteableNamein interfaceNamedWriteable
-
foldable
public boolean foldable()- Overrides:
foldablein classExpression
-
nullable
-
resolveType
- Overrides:
resolveTypein classExpression
-
categorizeDef
-
dataType
- Specified by:
dataTypein classExpression
-
replaceChildren
- Specified by:
replaceChildrenin classNode<Expression>
-
info
- Specified by:
infoin classNode<Expression>
-
field
-
toString
- Overrides:
toStringin classExpression
-
licenseCheck
Description copied from interface:LicenseAwareReturn true if the implementer can be executed under the providedXPackLicenseState, otherwise false.- Specified by:
licenseCheckin interfaceLicenseAware
-
postAnalysisPlanVerification
Description copied from interface:PostAnalysisPlanVerificationAwareAllows the implementer to return a consumer that will perform self-validation in the context of the tree structure the implementer is part of. This usually involves checking the type and configuration of the children or that of the parent.It is often more useful to perform the checks as extended as it makes sense, over stopping at the first failure. This will allow the author to progress faster to a correct query.
Example: a
GroupingFunctioninstance, which models a function to group documents to aggregate over, can only be used in the context of the STATS command, modeled by theAggregateclass. This is how this verification is performed:@Override public BiConsumer<LogicalPlan, Failures> postAnalysisPlanVerification() { return (p, failures) -> { if (p instanceof Aggregate == false) { p.forEachExpression( GroupingFunction.class, gf -> failures.add(fail(gf, "cannot use grouping function [{}] outside of a STATS command", gf.sourceText())) ); } }; }- Specified by:
postAnalysisPlanVerificationin interfacePostAnalysisPlanVerificationAware- Overrides:
postAnalysisPlanVerificationin classGroupingFunction- Returns:
- a consumer that will receive a tree to check and an accumulator of failures found during inspection.
-