Skip to content

Commit 3221487

Browse files
authored
License check for ES|QL categorize (#126595) (#126834)
1 parent a6f1f19 commit 3221487

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
@@ -11,6 +11,8 @@
1111
import org.elasticsearch.common.io.stream.StreamInput;
1212
import org.elasticsearch.common.io.stream.StreamOutput;
1313
import org.elasticsearch.compute.operator.EvalOperator.ExpressionEvaluator;
14+
import org.elasticsearch.license.XPackLicenseState;
15+
import org.elasticsearch.xpack.esql.LicenseAware;
1416
import org.elasticsearch.xpack.esql.core.expression.Expression;
1517
import org.elasticsearch.xpack.esql.core.expression.Nullability;
1618
import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
@@ -21,6 +23,7 @@
2123
import org.elasticsearch.xpack.esql.expression.function.FunctionType;
2224
import org.elasticsearch.xpack.esql.expression.function.Param;
2325
import org.elasticsearch.xpack.esql.io.stream.PlanStreamInput;
26+
import org.elasticsearch.xpack.ml.MachineLearning;
2427

2528
import java.io.IOException;
2629
import java.util.List;
@@ -37,7 +40,7 @@
3740
* For the implementation, see {@link org.elasticsearch.compute.aggregation.blockhash.CategorizeBlockHash}
3841
* </p>
3942
*/
40-
public class Categorize extends GroupingFunction {
43+
public class Categorize extends GroupingFunction implements LicenseAware {
4144
public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry(
4245
Expression.class,
4346
"Categorize",
@@ -134,4 +137,9 @@ public Expression field() {
134137
public String toString() {
135138
return "Categorize{field=" + field + "}";
136139
}
140+
141+
@Override
142+
public boolean licenseCheck(XPackLicenseState state) {
143+
return MachineLearning.CATEGORIZE_TEXT_AGG_FEATURE.check(state);
144+
}
137145
}

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
@@ -526,7 +526,7 @@ public class MachineLearning extends Plugin
526526
License.OperationMode.PLATINUM
527527
);
528528

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

0 commit comments

Comments
 (0)