Skip to content

Commit

Permalink
Fix categorize csv test (elastic#113089)
Browse files Browse the repository at this point in the history
* Move CATEGORIZE from EsqlFeatures to EsqlCapabilities

* Make CATEGORIZE csv test deterministic

* Unmute categorize test

* spotless

* Deterministic categorize csv test with category IDs
  • Loading branch information
jan-elastic authored and nik9000 committed Sep 19, 2024
1 parent 139e620 commit 5f35970
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ categorize
required_capability: categorize

FROM sample_data
| STATS count=COUNT(), values=VALUES(message) BY category=CATEGORIZE(message)
| SORT count DESC, category ASC
| SORT message ASC
| STATS count=COUNT(), values=MV_SORT(VALUES(message)) BY category=CATEGORIZE(message)
| SORT category
;

count:long | values:keyword | category:integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,12 @@ public enum Cap {
/**
* Support explicit casting from string literal to DATE_PERIOD or TIME_DURATION.
*/
CAST_STRING_LITERAL_TO_TEMPORAL_AMOUNT;
CAST_STRING_LITERAL_TO_TEMPORAL_AMOUNT,

/**
* Supported the text categorization function "CATEGORIZE".
*/
CATEGORIZE(true);

private final boolean snapshotOnly;
private final FeatureFlag featureFlag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,9 @@ public class EsqlFeatures implements FeatureSpecification {
*/
public static final NodeFeature RESOLVE_FIELDS_API = new NodeFeature("esql.resolve_fields_api");

/**
* Support categorize
*/
public static final NodeFeature CATEGORIZE = new NodeFeature("esql.categorize");

private Set<NodeFeature> snapshotBuildFeatures() {
assert Build.current().isSnapshot() : Build.current();
return Set.of(METRICS_SYNTAX, CATEGORIZE);
return Set.of(METRICS_SYNTAX);
}

@Override
Expand Down

0 comments on commit 5f35970

Please sign in to comment.