Skip to content

Commit 3fea686

Browse files
authored
Enable CCS for FORK only in snapshot (#134143)
1 parent c243306 commit 3fea686

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

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
@@ -1432,7 +1432,7 @@ public enum Cap {
14321432
/**
14331433
* FORK with remote indices
14341434
*/
1435-
ENABLE_FORK_FOR_REMOTE_INDICES;
1435+
ENABLE_FORK_FOR_REMOTE_INDICES(Build.current().isSnapshot());
14361436

14371437
private final boolean enabled;
14381438

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,9 @@ public PlanFactory visitForkCommand(EsqlBaseParser.ForkCommandContext ctx) {
719719
}
720720

721721
return input -> {
722+
if (EsqlCapabilities.Cap.ENABLE_LOOKUP_JOIN_ON_REMOTE.isEnabled() == false) {
723+
checkForRemoteClusters(input, source(ctx), "FORK");
724+
}
722725
List<LogicalPlan> subPlans = subQueries.stream().map(planFactory -> planFactory.apply(input)).toList();
723726
return new Fork(source(ctx), subPlans, List.of());
724727
};

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3627,6 +3627,14 @@ public void testInvalidFork() {
36273627
expectError("FROM foo* | FORK ( LIMIT 10 ) ( y+2 )", "line 1:33: mismatched input 'y+2'");
36283628
expectError("FROM foo* | FORK (where true) ()", "line 1:32: mismatched input ')'");
36293629
expectError("FROM foo* | FORK () (where true)", "line 1:19: mismatched input ')'");
3630+
3631+
if (EsqlCapabilities.Cap.ENABLE_FORK_FOR_REMOTE_INDICES.isEnabled() == false) {
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+
);
3637+
}
36303638
}
36313639

36323640
public void testFieldNamesAsCommands() throws Exception {

0 commit comments

Comments
 (0)