Skip to content

Commit 07b2bb4

Browse files
committed
FORK capability available for release builds
1 parent 00b9021 commit 07b2bb4

File tree

7 files changed

+40
-45
lines changed

7 files changed

+40
-45
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/rerank.csv-spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ book_no:keyword | title:text | author
9696

9797

9898
reranker after RRF
99-
required_capability: fork
99+
required_capability: fork_v9
100100
required_capability: rrf
101101
required_capability: match_operator_colon
102102
required_capability: rerank

x-pack/plugin/esql/qa/testFixtures/src/main/resources/rrf.csv-spec

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//
44

55
simpleRrf
6-
required_capability: fork
6+
required_capability: fork_v9
77
required_capability: rrf
88
required_capability: match_operator_colon
99

@@ -22,7 +22,7 @@ _score:double | _fork:keyword | emp_no:integer
2222
;
2323

2424
rrfWithMatchAndScore
25-
required_capability: fork
25+
required_capability: fork_v9
2626
required_capability: rrf
2727
required_capability: match_operator_colon
2828

@@ -44,7 +44,7 @@ _score:double | _fork:keyword | _id:keyword
4444
;
4545

4646
rrfWithDisjunctionAndPostFilter
47-
required_capability: fork
47+
required_capability: fork_v9
4848
required_capability: rrf
4949
required_capability: match_operator_colon
5050

@@ -66,7 +66,7 @@ _score:double | _fork:keyword | _id:keyword
6666
;
6767

6868
rrfWithStats
69-
required_capability: fork
69+
required_capability: fork_v9
7070
required_capability: rrf
7171
required_capability: match_operator_colon
7272

@@ -86,7 +86,7 @@ count_fork:long | _fork:keyword
8686
;
8787

8888
rrfWithMultipleForkBranches
89-
required_capability: fork
89+
required_capability: fork_v9
9090
required_capability: rrf
9191
required_capability: match_operator_colon
9292

@@ -112,7 +112,7 @@ _score:double | author:keyword | title:keyword | _fork
112112
;
113113

114114
rrfWithSemanticSearch
115-
required_capability: rrf
115+
required_capability: fork_v9
116116
required_capability: semantic_text_field_caps
117117
required_capability: metadata_score
118118

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/ForkIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class ForkIT extends AbstractEsqlIntegTestCase {
3232

3333
@Before
3434
public void setupIndex() {
35-
assumeTrue("requires FORK capability", EsqlCapabilities.Cap.FORK.isEnabled());
35+
assumeTrue("requires FORK capability", EsqlCapabilities.Cap.FORK_V9.isEnabled());
3636
createAndPopulateIndices();
3737
}
3838

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -917,11 +917,6 @@ public enum Cap {
917917
*/
918918
AGGREGATE_METRIC_DOUBLE_RENDERING(AGGREGATE_METRIC_DOUBLE_FEATURE_FLAG),
919919

920-
/**
921-
* Support for FORK command
922-
*/
923-
FORK(Build.current().isSnapshot()),
924-
925920
/**
926921
* Support for RERANK command
927922
*/
@@ -1038,9 +1033,9 @@ public enum Cap {
10381033
MAX_OVER_TIME(Build.current().isSnapshot()),
10391034

10401035
/**
1041-
* Support streaming of sub plan results
1036+
* Support for FORK out of snapshot
10421037
*/
1043-
FORK_V9(Build.current().isSnapshot()),
1038+
FORK_V9,
10441039

10451040
/**
10461041
* Support for the {@code leading_zeros} named parameter.

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/AnalyzerTests.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3066,8 +3066,6 @@ public void testResolveInsist_multiIndexFieldPartiallyExistsWithMultiTypesWithCa
30663066
}
30673067

30683068
public void testBasicFork() {
3069-
assumeTrue("requires FORK capability", EsqlCapabilities.Cap.FORK.isEnabled());
3070-
30713069
LogicalPlan plan = analyze("""
30723070
from test
30733071
| KEEP emp_no, first_name, last_name
@@ -3172,8 +3170,6 @@ public void testBasicFork() {
31723170
}
31733171

31743172
public void testForkBranchesWithDifferentSchemas() {
3175-
assumeTrue("requires FORK capability", EsqlCapabilities.Cap.FORK.isEnabled());
3176-
31773173
LogicalPlan plan = analyze("""
31783174
from test
31793175
| WHERE first_name == "Chris"
@@ -3299,8 +3295,6 @@ public void testForkBranchesWithDifferentSchemas() {
32993295
}
33003296

33013297
public void testForkError() {
3302-
assumeTrue("requires FORK capability", EsqlCapabilities.Cap.FORK.isEnabled());
3303-
33043298
var e = expectThrows(VerificationException.class, () -> analyze("""
33053299
from test
33063300
| FORK ( WHERE emp_no > 1 )
@@ -3421,8 +3415,6 @@ public void testValidRrf() {
34213415
}
34223416

34233417
public void testRrfError() {
3424-
assumeTrue("requires RRF capability", EsqlCapabilities.Cap.FORK.isEnabled());
3425-
34263418
var e = expectThrows(VerificationException.class, () -> analyze("""
34273419
from test
34283420
| rrf

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/parser/StatementParserTests.java

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3279,8 +3279,6 @@ public void testInvalidInsistAsterisk() {
32793279
}
32803280

32813281
public void testValidFork() {
3282-
assumeTrue("FORK requires corresponding capability", EsqlCapabilities.Cap.FORK.isEnabled());
3283-
32843282
var plan = statement("""
32853283
FROM foo*
32863284
| FORK ( WHERE a:"baz" | LIMIT 11 )
@@ -3369,6 +3367,33 @@ public void testValidFork() {
33693367
assertThat(dissect.parser().pattern(), equalTo("%{d} %{e} %{f}"));
33703368
}
33713369

3370+
public void testForkAllReleasedCommands() {
3371+
var query = """
3372+
FROM foo*
3373+
| FORK
3374+
( SORT c )
3375+
( LIMIT 5 )
3376+
( DISSECT a "%{d} %{e} %{f}" )
3377+
( GROK a "%{WORD:foo}" )
3378+
( STATS x = MIN(a), y = MAX(b) WHERE d > 1000 )
3379+
( EVAL xyz = ( (a/b) * (b/a)) )
3380+
( WHERE a < 1 )
3381+
( KEEP a )
3382+
( DROP b )
3383+
( RENAME a as c )
3384+
( MV_EXPAND a )
3385+
( CHANGE_POINT a on b )
3386+
( LOOKUP JOIN idx2 ON f1 )
3387+
( ENRICH idx2 on f1 with f2 = f3 )
3388+
( FORK ( WHERE a:"baz" ) ( EVAL x = [ 1, 2, 3 ] ) )
3389+
( COMPLETION a = b WITH c )
3390+
| KEEP a
3391+
""";
3392+
3393+
var plan = statement(query);
3394+
assertThat(plan, instanceOf(Keep.class));
3395+
}
3396+
33723397
public void testForkAllCommands() {
33733398
assumeTrue("requires snapshot build", Build.current().isSnapshot());
33743399

@@ -3380,21 +3405,21 @@ public void testForkAllCommands() {
33803405
( DISSECT a "%{d} %{e} %{f}" )
33813406
( GROK a "%{WORD:foo}" )
33823407
( STATS x = MIN(a), y = MAX(b) WHERE d > 1000 )
3383-
( INLINESTATS x = MIN(a), y = MAX(b) WHERE d > 1000 )
33843408
( EVAL xyz = ( (a/b) * (b/a)) )
33853409
( WHERE a < 1 )
33863410
( KEEP a )
33873411
( DROP b )
33883412
( RENAME a as c )
33893413
( MV_EXPAND a )
3390-
( INSIST_🐔 a )
33913414
( CHANGE_POINT a on b )
33923415
( LOOKUP JOIN idx2 ON f1 )
3393-
( LOOKUP_🐔 a on b )
33943416
( ENRICH idx2 on f1 with f2 = f3 )
33953417
( FORK ( WHERE a:"baz" ) ( EVAL x = [ 1, 2, 3 ] ) )
33963418
( COMPLETION a = b WITH c )
33973419
( SAMPLE 0.99 )
3420+
( INLINESTATS x = MIN(a), y = MAX(b) WHERE d > 1000 )
3421+
( INSIST_🐔 a )
3422+
( LOOKUP_🐔 a on b )
33983423
| KEEP a
33993424
""";
34003425

@@ -3403,8 +3428,6 @@ public void testForkAllCommands() {
34033428
}
34043429

34053430
public void testInvalidFork() {
3406-
assumeTrue("FORK requires corresponding capability", EsqlCapabilities.Cap.FORK.isEnabled());
3407-
34083431
expectError("FROM foo* | FORK (WHERE a:\"baz\")", "line 1:13: Fork requires at least two branches");
34093432
expectError("FROM foo* | FORK (LIMIT 10)", "line 1:13: Fork requires at least two branches");
34103433
expectError("FROM foo* | FORK (SORT a)", "line 1:13: Fork requires at least two branches");

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/session/IndexResolverFieldNamesTests.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,8 +1999,6 @@ public void testDropWildcardFields_WithLookupJoin() {
19991999
}
20002000

20012001
public void testForkFieldsWithKeepAfterFork() {
2002-
assumeTrue("FORK available as snapshot only", EsqlCapabilities.Cap.FORK.isEnabled());
2003-
20042002
assertFieldNames("""
20052003
FROM test
20062004
| WHERE a > 2000
@@ -2013,8 +2011,6 @@ public void testForkFieldsWithKeepAfterFork() {
20132011
}
20142012

20152013
public void testForkFieldsWithKeepBeforeFork() {
2016-
assumeTrue("FORK available as snapshot only", EsqlCapabilities.Cap.FORK.isEnabled());
2017-
20182014
assertFieldNames("""
20192015
FROM test
20202016
| KEEP a, b, c, d, x, y
@@ -2027,8 +2023,6 @@ public void testForkFieldsWithKeepBeforeFork() {
20272023
}
20282024

20292025
public void testForkFieldsWithNoProjection() {
2030-
assumeTrue("FORK available as snapshot only", EsqlCapabilities.Cap.FORK.isEnabled());
2031-
20322026
assertFieldNames("""
20332027
FROM test
20342028
| WHERE a > 2000
@@ -2040,8 +2034,6 @@ public void testForkFieldsWithNoProjection() {
20402034
}
20412035

20422036
public void testForkFieldsWithStatsInOneBranch() {
2043-
assumeTrue("FORK available as snapshot only", EsqlCapabilities.Cap.FORK.isEnabled());
2044-
20452037
assertFieldNames("""
20462038
FROM test
20472039
| WHERE a > 2000
@@ -2053,9 +2045,6 @@ public void testForkFieldsWithStatsInOneBranch() {
20532045
}
20542046

20552047
public void testForkFieldsWithEnrichAndLookupJoins() {
2056-
assumeTrue("FORK available as snapshot only", EsqlCapabilities.Cap.FORK.isEnabled());
2057-
assumeTrue("LOOKUP JOIN available as snapshot only", EsqlCapabilities.Cap.JOIN_LOOKUP_V12.isEnabled());
2058-
20592048
assertFieldNames("""
20602049
FROM test
20612050
| KEEP a, b, abc, def, z, xyz
@@ -2070,8 +2059,6 @@ public void testForkFieldsWithEnrichAndLookupJoins() {
20702059
}
20712060

20722061
public void testForkWithStatsInAllBranches() {
2073-
assumeTrue("FORK available as snapshot only", EsqlCapabilities.Cap.FORK.isEnabled());
2074-
20752062
assertFieldNames("""
20762063
FROM test
20772064
| WHERE a > 2000
@@ -2084,8 +2071,6 @@ public void testForkWithStatsInAllBranches() {
20842071
}
20852072

20862073
public void testForkWithStatsAndWhere() {
2087-
assumeTrue("FORK available as snapshot only", EsqlCapabilities.Cap.FORK.isEnabled());
2088-
20892074
assertFieldNames(" FROM employees | FORK ( WHERE true | stats min(salary) by gender) ( WHERE true | LIMIT 3 )", ALL_FIELDS);
20902075
}
20912076

0 commit comments

Comments
 (0)