Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ public enum Cap {
/**
* FORK with remote indices
*/
ENABLE_FORK_FOR_REMOTE_INDICES;
ENABLE_FORK_FOR_REMOTE_INDICES(Build.current().isSnapshot());

private final boolean enabled;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,9 @@ public PlanFactory visitForkCommand(EsqlBaseParser.ForkCommandContext ctx) {
}

return input -> {
if (EsqlCapabilities.Cap.ENABLE_LOOKUP_JOIN_ON_REMOTE.isEnabled() == false) {
checkForRemoteClusters(input, source(ctx), "FORK");
}
List<LogicalPlan> subPlans = subQueries.stream().map(planFactory -> planFactory.apply(input)).toList();
return new Fork(source(ctx), subPlans, List.of());
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3627,6 +3627,14 @@ public void testInvalidFork() {
expectError("FROM foo* | FORK ( LIMIT 10 ) ( y+2 )", "line 1:33: mismatched input 'y+2'");
expectError("FROM foo* | FORK (where true) ()", "line 1:32: mismatched input ')'");
expectError("FROM foo* | FORK () (where true)", "line 1:19: mismatched input ')'");

if (EsqlCapabilities.Cap.ENABLE_FORK_FOR_REMOTE_INDICES.isEnabled() == false) {
var fromPatterns = randomIndexPatterns(CROSS_CLUSTER);
expectError(
"FROM " + fromPatterns + " | FORK (EVAL a = 1) (EVAL a = 2)",
"invalid index pattern [" + unquoteIndexPattern(fromPatterns) + "], remote clusters are not supported with FORK"
);
}
}

public void testFieldNamesAsCommands() throws Exception {
Expand Down