Skip to content

Commit c5746b3

Browse files
authored
ES|QL: Enable CCS tests for FORK (elastic#139302)
1 parent 6ed40ee commit c5746b3

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

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

Lines changed: 7 additions & 1 deletion
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_V2;
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.INLINE_STATS;
@@ -167,7 +168,12 @@ protected void shouldSkipTest(String testName) throws IOException {
167168
// Tests that do SORT before LOOKUP JOIN - not supported in CCS
168169
assumeFalse("LOOKUP JOIN after SORT not yet supported in CCS", testName.contains("OnTheCoordinator"));
169170

170-
assumeFalse("FORK not yet supported with CCS", testCase.requiredCapabilities.contains(FORK_V9.capabilityName()));
171+
if (testCase.requiredCapabilities.contains(FORK_V9.capabilityName())) {
172+
assumeTrue(
173+
"FORK not yet supported with CCS",
174+
hasCapabilities(adminClient(), List.of(ENABLE_FORK_FOR_REMOTE_INDICES_V2.capabilityName()))
175+
);
176+
}
171177
}
172178

173179
private TestFeatureService remoteFeaturesService() throws IOException {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,9 @@ null | null | 4 | 172.21.3.15
319319
;
320320

321321
subqueryWithCountStarAndDateTrunc
322-
required_capability: fork_v9
323322
required_capability: subquery_in_from_command
324323

325-
FROM employees, (FROM sample_data
324+
FROM employees, (FROM sample_data metadata _index
326325
| STATS cnt = count(*) by ts=date_trunc(1 hour, @timestamp)
327326
| SORT cnt DESC
328327
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1469,7 +1469,7 @@ public enum Cap {
14691469
/**
14701470
* FORK with remote indices
14711471
*/
1472-
ENABLE_FORK_FOR_REMOTE_INDICES(Build.current().isSnapshot()),
1472+
ENABLE_FORK_FOR_REMOTE_INDICES_V2(Build.current().isSnapshot()),
14731473

14741474
/**
14751475
* Support for the Present function

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ public PlanFactory visitForkCommand(EsqlBaseParser.ForkCommandContext ctx) {
972972
}
973973

974974
return input -> {
975-
if (EsqlCapabilities.Cap.ENABLE_FORK_FOR_REMOTE_INDICES.isEnabled() == false) {
975+
if (EsqlCapabilities.Cap.ENABLE_FORK_FOR_REMOTE_INDICES_V2.isEnabled() == false) {
976976
checkForRemoteClusters(input, source(ctx), "FORK");
977977
}
978978
List<LogicalPlan> subPlans = subQueries.stream().map(planFactory -> planFactory.apply(input)).toList();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3580,7 +3580,7 @@ public void testInvalidFork() {
35803580
expectError("FROM foo* | FORK (where true) ()", "line 1:32: mismatched input ')'");
35813581
expectError("FROM foo* | FORK () (where true)", "line 1:19: mismatched input ')'");
35823582

3583-
if (EsqlCapabilities.Cap.ENABLE_FORK_FOR_REMOTE_INDICES.isEnabled() == false) {
3583+
if (EsqlCapabilities.Cap.ENABLE_FORK_FOR_REMOTE_INDICES_V2.isEnabled() == false) {
35843584
var fromPatterns = randomIndexPatterns(CROSS_CLUSTER);
35853585
expectError(
35863586
"FROM " + fromPatterns + " | FORK (EVAL a = 1) (EVAL a = 2)",

0 commit comments

Comments
 (0)