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 @@ -48,6 +48,7 @@
import static org.elasticsearch.xpack.esql.CsvTestsDataLoader.CSV_DATASET_MAP;
import static org.elasticsearch.xpack.esql.CsvTestsDataLoader.ENRICH_SOURCE_INDICES;
import static org.elasticsearch.xpack.esql.EsqlTestUtils.classpathResources;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.ENABLE_FORK_FOR_REMOTE_INDICES_V2;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.ENABLE_LOOKUP_JOIN_ON_REMOTE;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.FORK_V9;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.INLINE_STATS;
Expand Down Expand Up @@ -167,7 +168,12 @@ protected void shouldSkipTest(String testName) throws IOException {
// Tests that do SORT before LOOKUP JOIN - not supported in CCS
assumeFalse("LOOKUP JOIN after SORT not yet supported in CCS", testName.contains("OnTheCoordinator"));

assumeFalse("FORK not yet supported with CCS", testCase.requiredCapabilities.contains(FORK_V9.capabilityName()));
if (testCase.requiredCapabilities.contains(FORK_V9.capabilityName())) {
assumeTrue(
"FORK not yet supported with CCS",
hasCapabilities(adminClient(), List.of(ENABLE_FORK_FOR_REMOTE_INDICES_V2.capabilityName()))
);
}
}

private TestFeatureService remoteFeaturesService() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,9 @@ null | null | 4 | 172.21.3.15
;

subqueryWithCountStarAndDateTrunc
required_capability: fork_v9
required_capability: subquery_in_from_command

FROM employees, (FROM sample_data
FROM employees, (FROM sample_data metadata _index
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/elastic/elasticsearch/pull/137776/files#diff-ce2360e7ca89b74f2454822d45cbadf8d4218f97777df7d160a0863053a041fc for all subqueries tests we removed the fork_v9 capability and we pushed the metadata _index in the subqueries.

this means this test was not enabled for CCS, and once we enabled the FORK tests, this test was failing because the _index metadata column contained values that had the remote index tag:


Actual: |  
-- | --
_index:keyword           \| emp_no:integer \| languages:integer \| cnt:long \| ts:datetime |  
remote_cluster:employees \| 10091          \| 3                 \| null     \| null |  
remote_cluster:employees \| 10092          \| 1                 \| null     \| null |  
remote_cluster:employees \| 10093          \| 3                 \| null     \| null |  
null                     \| null           \| null              \| 2        \| 2023-10-23T12:00:00.000Z |  
null                     \| null           \| null              \| 5        \| 2023-10-23T13:00:00.000Z |  
  |  
Expected: |  
_index:keyword \| emp_no:integer \| languages:integer \| cnt:long \| ts:datetime |  
employees      \| 10091          \| 3                 \| null     \| null |  
employees      \| 10092          \| 1                 \| null     \| null |  
employees      \| 10093          \| 3                 \| null     \| null |  
null           \| null           \| null              \| 2        \| 2023-10-23T12:00:00.000Z |  
null           \| null           \| null              \| 5        \| 2023-10-23T13:00:00.000Z


I think that during #137776 we just missed this test, so these changes here should be safe to make.

| STATS cnt = count(*) by ts=date_trunc(1 hour, @timestamp)
| SORT cnt DESC
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,7 @@ public enum Cap {
/**
* FORK with remote indices
*/
ENABLE_FORK_FOR_REMOTE_INDICES(Build.current().isSnapshot()),
ENABLE_FORK_FOR_REMOTE_INDICES_V2(Build.current().isSnapshot()),

/**
* Support for the Present function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ public PlanFactory visitForkCommand(EsqlBaseParser.ForkCommandContext ctx) {
}

return input -> {
if (EsqlCapabilities.Cap.ENABLE_FORK_FOR_REMOTE_INDICES.isEnabled() == false) {
if (EsqlCapabilities.Cap.ENABLE_FORK_FOR_REMOTE_INDICES_V2.isEnabled() == false) {
checkForRemoteClusters(input, source(ctx), "FORK");
}
List<LogicalPlan> subPlans = subQueries.stream().map(planFactory -> planFactory.apply(input)).toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3580,7 +3580,7 @@ public void testInvalidFork() {
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) {
if (EsqlCapabilities.Cap.ENABLE_FORK_FOR_REMOTE_INDICES_V2.isEnabled() == false) {
var fromPatterns = randomIndexPatterns(CROSS_CLUSTER);
expectError(
"FROM " + fromPatterns + " | FORK (EVAL a = 1) (EVAL a = 2)",
Expand Down