Skip to content

Commit 7474849

Browse files
authored
License check for ES|QL categorize (#126595)
1 parent c906cc0 commit 7474849

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/grouping/Categorize.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
1111
import org.elasticsearch.common.io.stream.StreamInput;
1212
import org.elasticsearch.common.io.stream.StreamOutput;
13+
import org.elasticsearch.license.XPackLicenseState;
14+
import org.elasticsearch.xpack.esql.LicenseAware;
1315
import org.elasticsearch.xpack.esql.core.expression.Expression;
1416
import org.elasticsearch.xpack.esql.core.expression.Nullability;
1517
import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
@@ -20,6 +22,7 @@
2022
import org.elasticsearch.xpack.esql.expression.function.FunctionType;
2123
import org.elasticsearch.xpack.esql.expression.function.Param;
2224
import org.elasticsearch.xpack.esql.io.stream.PlanStreamInput;
25+
import org.elasticsearch.xpack.ml.MachineLearning;
2326

2427
import java.io.IOException;
2528
import java.util.List;
@@ -36,7 +39,7 @@
3639
* For the implementation, see {@link org.elasticsearch.compute.aggregation.blockhash.CategorizeBlockHash}
3740
* </p>
3841
*/
39-
public class Categorize extends GroupingFunction.NonEvaluatableGroupingFunction {
42+
public class Categorize extends GroupingFunction.NonEvaluatableGroupingFunction implements LicenseAware {
4043
public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry(
4144
Expression.class,
4245
"Categorize",
@@ -128,4 +131,9 @@ public Expression field() {
128131
public String toString() {
129132
return "Categorize{field=" + field + "}";
130133
}
134+
135+
@Override
136+
public boolean licenseCheck(XPackLicenseState state) {
137+
return MachineLearning.CATEGORIZE_TEXT_AGG_FEATURE.check(state);
138+
}
131139
}

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ public class MachineLearning extends Plugin
525525
License.OperationMode.PLATINUM
526526
);
527527

528-
private static final LicensedFeature.Momentary CATEGORIZE_TEXT_AGG_FEATURE = LicensedFeature.momentary(
528+
public static final LicensedFeature.Momentary CATEGORIZE_TEXT_AGG_FEATURE = LicensedFeature.momentary(
529529
MachineLearningField.ML_FEATURE_FAMILY,
530530
"categorize-text-agg",
531531
License.OperationMode.PLATINUM

0 commit comments

Comments
 (0)