Skip to content

Commit 2b16c15

Browse files
Merge branch 'main' into take-date-nanos-implicit-casting-out-of-snapshot
2 parents 5b195fe + 580f734 commit 2b16c15

File tree

6 files changed

+96
-85
lines changed

6 files changed

+96
-85
lines changed

muted-tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,10 @@ tests:
549549
- class: org.elasticsearch.xpack.cluster.routing.allocation.DataTierAllocationDeciderIT
550550
method: testShardsAreKeptInPreferredTierUntilTheNextTierIsInItsFinalState
551551
issue: https://github.com/elastic/elasticsearch/issues/134050
552+
- class: org.elasticsearch.xpack.esql.expression.function.aggregate.ValuesTests
553+
issue: https://github.com/elastic/elasticsearch/issues/134072
554+
- class: org.elasticsearch.xpack.esql.expression.function.aggregate.SampleTests
555+
issue: https://github.com/elastic/elasticsearch/issues/134072
552556

553557
# Examples:
554558
#

x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterSpecIT.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import static org.elasticsearch.xpack.esql.CsvTestsDataLoader.CSV_DATASET_MAP;
4949
import static org.elasticsearch.xpack.esql.CsvTestsDataLoader.ENRICH_SOURCE_INDICES;
5050
import static org.elasticsearch.xpack.esql.EsqlTestUtils.classpathResources;
51+
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.ENABLE_FORK_FOR_REMOTE_INDICES;
5152
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.ENABLE_LOOKUP_JOIN_ON_REMOTE;
5253
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.FORK_V9;
5354
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.INLINESTATS;
@@ -116,7 +117,9 @@ public MultiClusterSpecIT(
116117
"LookupJoinOnTwoFieldsAfterTop",
117118
"LookupJoinOnTwoFieldsMultipleTimes",
118119
// Lookup join after LIMIT is not supported in CCS yet
119-
"LookupJoinAfterLimitAndRemoteEnrich"
120+
"LookupJoinAfterLimitAndRemoteEnrich",
121+
// Lookup join after FORK is not support in CCS yet
122+
"ForkBeforeLookupJoin"
120123
);
121124

122125
@Override
@@ -146,7 +149,6 @@ protected void shouldSkipTest(String testName) throws IOException {
146149
}
147150
// Unmapped fields require a coorect capability response from every cluster, which isn't currently implemented.
148151
assumeFalse("UNMAPPED FIELDS not yet supported in CCS", testCase.requiredCapabilities.contains(UNMAPPED_FIELDS.capabilityName()));
149-
assumeFalse("FORK not yet supported in CCS", testCase.requiredCapabilities.contains(FORK_V9.capabilityName()));
150152
// Tests that use capabilities not supported in CCS
151153
assumeFalse(
152154
"This syntax is not supported with remote LOOKUP JOIN",
@@ -155,6 +157,12 @@ protected void shouldSkipTest(String testName) throws IOException {
155157
// Tests that do SORT before LOOKUP JOIN - not supported in CCS
156158
assumeFalse("LOOKUP JOIN after SORT not yet supported in CCS", testName.contains("OnTheCoordinator"));
157159

160+
if (testCase.requiredCapabilities.contains(FORK_V9.capabilityName())) {
161+
assumeTrue(
162+
"FORK not yet supported with CCS",
163+
hasCapabilities(adminClient(), List.of(ENABLE_FORK_FOR_REMOTE_INDICES.capabilityName()))
164+
);
165+
}
158166
}
159167

160168
@Override

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

Lines changed: 76 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -384,133 +384,134 @@ a:long | b:keyword | _fork:keyword
384384
forkAfterDrop
385385
required_capability: fork_v9
386386

387-
FROM languages
388-
| DROP language_code
389-
| FORK ( WHERE language_name == "English" | EVAL x = 1 )
390-
( WHERE language_name != "English" )
391-
| SORT _fork, language_name
387+
FROM employees
388+
| DROP first_name
389+
| FORK ( WHERE emp_no == 10048 OR emp_no == 10081 | EVAL x = 1 )
390+
( WHERE emp_no == 10048 )
391+
| SORT _fork, emp_no, x
392+
| KEEP emp_no, x, _fork
392393
;
393394

394-
language_name:keyword | x:integer | _fork:keyword
395-
English | 1 | fork1
396-
French | null | fork2
397-
German | null | fork2
398-
Spanish | null | fork2
395+
emp_no:integer | x:integer | _fork:keyword
396+
10048 | 1 | fork1
397+
10081 | 1 | fork1
398+
10048 | null | fork2
399399
;
400400

401401
forkBranchWithDrop
402402
required_capability: fork_v9
403403

404-
FROM languages
405-
| FORK ( EVAL x = 1 | DROP language_code | WHERE language_name == "English" | DROP x )
406-
( WHERE language_name != "English" )
407-
| SORT _fork, language_name
408-
| KEEP language_name, language_code, _fork
404+
FROM employees
405+
| FORK ( EVAL x = 1 | DROP first_name | WHERE emp_no == 10048 OR emp_no == 10081 | DROP x )
406+
( WHERE emp_no == 10048 )
407+
| SORT _fork, emp_no
408+
| KEEP emp_no, _fork
409409
;
410410

411-
language_name:keyword | language_code:integer | _fork:keyword
412-
English | null | fork1
413-
French | 2 | fork2
414-
German | 4 | fork2
415-
Spanish | 3 | fork2
411+
emp_no:integer | _fork:keyword
412+
10048 | fork1
413+
10081 | fork1
414+
10048 | fork2
416415
;
417416

418-
419417
forkBeforeDrop
420418
required_capability: fork_v9
421419

422-
FROM languages
423-
| FORK (WHERE language_code == 1 OR language_code == 2)
424-
(WHERE language_code == 1)
425-
| DROP language_code
426-
| SORT _fork, language_name
420+
FROM employees
421+
| FORK ( WHERE emp_no == 10048 OR emp_no == 10081 | EVAL x = 1 )
422+
( WHERE emp_no == 10048 )
423+
| DROP first_name, x
424+
| SORT _fork, emp_no
425+
| KEEP emp_no, _fork
427426
;
428427

429-
language_name:keyword | _fork:keyword
430-
English | fork1
431-
French | fork1
432-
English | fork2
428+
emp_no:integer | _fork:keyword
429+
10048 | fork1
430+
10081 | fork1
431+
10048 | fork2
433432
;
434433

435434
forkBranchWithKeep
436435
required_capability: fork_v9
437436

438-
FROM languages
439-
| FORK ( WHERE language_name == "English" | KEEP language_name, language_code )
440-
( WHERE language_name != "English" )
441-
| SORT _fork, language_name
437+
FROM employees
438+
| FORK ( WHERE emp_no == 10048 OR emp_no == 10081 | KEEP emp_no )
439+
( WHERE emp_no == 10048 )
440+
| SORT _fork, emp_no
441+
| KEEP emp_no, _fork
442442
;
443443

444-
language_name:keyword | language_code:integer | _fork:keyword
445-
English | 1 | fork1
446-
French | 2 | fork2
447-
German | 4 | fork2
448-
Spanish | 3 | fork2
444+
emp_no:integer | _fork:keyword
445+
10048 | fork1
446+
10081 | fork1
447+
10048 | fork2
449448
;
450449

451450
forkBeforeRename
452451
required_capability: fork_v9
453452

454-
FROM languages
455-
| FORK (WHERE language_code == 1 OR language_code == 2)
456-
(WHERE language_code == 1)
457-
| RENAME language_code AS code
458-
| SORT _fork, language_name
453+
FROM employees
454+
| FORK ( WHERE emp_no == 10048 OR emp_no == 10081 )
455+
( WHERE emp_no == 10048 )
456+
| RENAME emp_no AS code
457+
| SORT _fork, code
458+
| KEEP code, _fork
459459
;
460460

461-
code:integer | language_name:keyword | _fork:keyword
462-
1 | English | fork1
463-
2 | French | fork1
464-
1 | English | fork2
461+
code:integer | _fork:keyword
462+
10048 | fork1
463+
10081 | fork1
464+
10048 | fork2
465465
;
466466

467467
forkBranchWithRenameAs
468468
required_capability: fork_v9
469469

470-
FROM languages
471-
| FORK (RENAME language_code AS code | WHERE code == 1 OR code == 2)
472-
(WHERE language_code == 1 | RENAME language_code AS x)
473-
| SORT _fork, language_name
474-
| KEEP code, language_name, x, _fork
470+
FROM employees
471+
| FORK (RENAME emp_no AS emp_code | WHERE emp_code == 10048 OR emp_code == 10081)
472+
(WHERE emp_no == 10048 | RENAME emp_no AS x)
473+
| SORT _fork, emp_code, x
474+
| KEEP emp_code, x, _fork
475475
;
476476

477-
code:integer | language_name:keyword | x:integer | _fork:keyword
478-
1 | English | null | fork1
479-
2 | French | null | fork1
480-
null | English | 1 | fork2
477+
emp_code:integer | x:integer | _fork:keyword
478+
10048 | null | fork1
479+
10081 | null | fork1
480+
null | 10048 | fork2
481481
;
482482

483483
forkBranchWithRenameEquals
484484
required_capability: fork_v9
485485

486-
FROM languages
487-
| FORK (RENAME code = language_code | WHERE code == 1 OR code == 2)
488-
(WHERE language_code == 1 | RENAME x = language_code)
489-
| SORT _fork, language_name
490-
| KEEP code, language_name, x, _fork
486+
FROM employees
487+
| FORK (RENAME emp_code = emp_no | WHERE emp_code == 10048 OR emp_code == 10081)
488+
(WHERE emp_no == 10048 | RENAME x = emp_no)
489+
| SORT _fork, emp_code, x
490+
| KEEP emp_code, x, _fork
491491
;
492492

493-
code:integer | language_name:keyword | x:integer | _fork:keyword
494-
1 | English | null | fork1
495-
2 | French | null | fork1
496-
null | English | 1 | fork2
493+
emp_code:integer | x:integer | _fork:keyword
494+
10048 | null | fork1
495+
10081 | null | fork1
496+
null | 10048 | fork2
497497
;
498498

499499

500500
forkAfterRename
501501
required_capability: fork_v9
502502

503-
FROM languages
504-
| RENAME language_code AS code
505-
| FORK (WHERE code == 1 OR code == 2)
506-
(WHERE code == 1)
507-
| SORT _fork, language_name
503+
FROM employees
504+
| RENAME emp_no AS emp_code
505+
| FORK (WHERE emp_code == 10048 OR emp_code == 10081)
506+
(WHERE emp_code == 10048)
507+
| SORT _fork, emp_code
508+
| KEEP emp_code, _fork
508509
;
509510

510-
code:integer | language_name:keyword | _fork:keyword
511-
1 | English | fork1
512-
2 | French | fork1
513-
1 | English | fork2
511+
emp_code:integer | _fork:keyword
512+
10048 | fork1
513+
10081 | fork1
514+
10048 | fork2
514515
;
515516

516517

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,12 @@ public enum Cap {
14271427
/**
14281428
* URL decoding function.
14291429
*/
1430-
URL_DECODE(Build.current().isSnapshot());
1430+
URL_DECODE(Build.current().isSnapshot()),
1431+
1432+
/**
1433+
* FORK with remote indices
1434+
*/
1435+
ENABLE_FORK_FOR_REMOTE_INDICES;
14311436

14321437
private final boolean enabled;
14331438

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/LogicalPlanBuilder.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,6 @@ public PlanFactory visitForkCommand(EsqlBaseParser.ForkCommandContext ctx) {
722722
}
723723

724724
return input -> {
725-
checkForRemoteClusters(input, source(ctx), "FORK");
726725
List<LogicalPlan> subPlans = subQueries.stream().map(planFactory -> planFactory.apply(input)).toList();
727726
return new Fork(source(ctx), subPlans, List.of());
728727
};

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3628,12 +3628,6 @@ public void testInvalidFork() {
36283628
expectError("FROM foo* | FORK ( LIMIT 10 ) ( y+2 )", "line 1:33: mismatched input 'y+2'");
36293629
expectError("FROM foo* | FORK (where true) ()", "line 1:32: mismatched input ')'");
36303630
expectError("FROM foo* | FORK () (where true)", "line 1:19: mismatched input ')'");
3631-
3632-
var fromPatterns = randomIndexPatterns(CROSS_CLUSTER);
3633-
expectError(
3634-
"FROM " + fromPatterns + " | FORK (EVAL a = 1) (EVAL a = 2)",
3635-
"invalid index pattern [" + unquoteIndexPattern(fromPatterns) + "], remote clusters are not supported with FORK"
3636-
);
36373631
}
36383632

36393633
public void testFieldNamesAsCommands() throws Exception {

0 commit comments

Comments
 (0)