Skip to content

ESQL: More specific index pattern in testMultipleBatchesWithLookupJoin #130006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

alex-spies
Copy link
Contributor

Do not use from * in the test, be more specifc - otherwise other tests can affect the output if they leave indices behind, affecting the column count.

We encountered a test failure in release tests; I wasn't able to reproduce, but this change should avoid any potential flakiness due to other tests affecting the global state that we run this test in.

Do not use `from *` in the test, be more specifc - otherwise other tests
can affect the output if they leave indices behind, affecting the column
count.
@alex-spies alex-spies added >test Issues or PRs that are addressing/adding tests :Analytics/ES|QL AKA ESQL v8.19.0 v9.1.0 labels Jun 25, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jun 25, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@alex-spies alex-spies added the auto-backport Automatically create backport pull requests when merged label Jun 25, 2025
@@ -1014,12 +1014,14 @@ public void testMultipleBatchesWithLookupJoin() throws IOException {
// Create more than 10 indices to trigger multiple batches of data node execution.
// The sort field should be missing on some indices to reproduce NullPointerException caused by duplicated items in layout
for (int i = 1; i <= 20; i++) {
createIndex("idx" + i, randomBoolean(), "\"mappings\": {\"properties\" : {\"a\" : {\"type\" : \"keyword\"}}}");
createIndex("no_sort_field_idx" + i, randomBoolean(), "\"mappings\": {\"properties\" : {\"a\" : {\"type\" : \"keyword\"}}}");
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should go one step forward and rely on randomIdentifier() for the index name here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes clean up a little harder as I'd need to keep track of the index names to delete them later or make it so I can perform a wildcard delete. This should be fine, I don't think this was the root cause of the failure.

var query = requestObjectBuilder().query(format(null, "from * | lookup join {} on integer {}", testIndexName(), sort));
var query = requestObjectBuilder().query(
format(null, "from {},no_sort_field_idx* | lookup join {} on integer {}", testIndexName(), testIndexName(), sort)
);
Map<String, Object> result = runEsql(query);
var columns = as(result.get("columns"), List.class);
assertEquals(22, columns.size());
Copy link
Member

Choose a reason for hiding this comment

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

Another option is removing the column count validation, as this test needs to be updated every time a new field is added to the default index. It is weird where the extra column comes from though, I thought at the beginning of the tests, all existing indices are cleaned up, we should only have a deterministic number of columns in the resultset.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Assertion deleted in the next push!

That doesn't really tell us much in this test, anyway.
@alex-spies alex-spies added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Jun 25, 2025
Copy link
Member

@fang-xing-esql fang-xing-esql left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@alex-spies
Copy link
Contributor Author

Only failure is in an unrelated spec test on Serverless, which this PR can't affect. This is safe to merge.

@alex-spies alex-spies merged commit 1ad6dbc into elastic:main Jun 26, 2025
32 of 33 checks passed
@alex-spies alex-spies deleted the make-layout-failure-test-more-specific branch June 26, 2025 13:06
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.19
9.2 The branch "9.2" is invalid or doesn't exist

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 130006

alex-spies added a commit to alex-spies/elasticsearch that referenced this pull request Jun 26, 2025
elastic#130006)

* Specific idx in testMultipleBatchesWithLookupJoin

Do not use `from *` in the test, be more specifc - otherwise other tests
can affect the output if they leave indices behind, affecting the column
count.

* Remove column count validation

That doesn't really tell us much in this test, anyway.
elasticsearchmachine pushed a commit that referenced this pull request Jun 26, 2025
#130006) (#130116)

* Specific idx in testMultipleBatchesWithLookupJoin

Do not use `from *` in the test, be more specifc - otherwise other tests
can affect the output if they leave indices behind, affecting the column
count.

* Remove column count validation

That doesn't really tell us much in this test, anyway.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport pending Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) >test Issues or PRs that are addressing/adding tests v8.19.0 v9.1.0 v9.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants