Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.compute.operator.EvalOperator.ExpressionEvaluator;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.xpack.esql.LicenseAware;
import org.elasticsearch.xpack.esql.core.expression.Expression;
import org.elasticsearch.xpack.esql.core.expression.Nullability;
import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
Expand All @@ -21,6 +23,7 @@
import org.elasticsearch.xpack.esql.expression.function.FunctionType;
import org.elasticsearch.xpack.esql.expression.function.Param;
import org.elasticsearch.xpack.esql.io.stream.PlanStreamInput;
import org.elasticsearch.xpack.ml.MachineLearning;

import java.io.IOException;
import java.util.List;
Expand All @@ -37,7 +40,7 @@
* For the implementation, see {@link org.elasticsearch.compute.aggregation.blockhash.CategorizeBlockHash}
* </p>
*/
public class Categorize extends GroupingFunction {
public class Categorize extends GroupingFunction implements LicenseAware {
public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry(
Expression.class,
"Categorize",
Expand Down Expand Up @@ -134,4 +137,9 @@ public Expression field() {
public String toString() {
return "Categorize{field=" + field + "}";
}

@Override
public boolean licenseCheck(XPackLicenseState state) {
return MachineLearning.CATEGORIZE_TEXT_AGG_FEATURE.check(state);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ public class MachineLearning extends Plugin
License.OperationMode.PLATINUM
);

private static final LicensedFeature.Momentary CATEGORIZE_TEXT_AGG_FEATURE = LicensedFeature.momentary(
public static final LicensedFeature.Momentary CATEGORIZE_TEXT_AGG_FEATURE = LicensedFeature.momentary(
MachineLearningField.ML_FEATURE_FAMILY,
"categorize-text-agg",
License.OperationMode.PLATINUM
Expand Down