Skip to content

Conversation

@smalyshev
Copy link
Contributor

@smalyshev smalyshev commented Sep 8, 2025

INLINESTATS works by running query subplans, which are exactly like regular query plans, except at the end of it the query does not end but moves on to another subplan - or to the main plan.

In order to make it work with CCS, we need to:

  • Ensure that clusters are not put into terminal state at the end of subplan, but only at the end of main plan
  • Ensure that timings of subplans and the main plan are accumulated correctly
  • Ensure that the errors that may happen during any of the plans are reported correctly.

Closes #124748

@elasticsearchmachine
Copy link
Collaborator

Hi @smalyshev, I've created a changelog YAML for you.

@smalyshev smalyshev marked this pull request as ready for review September 12, 2025 16:39
@elasticsearchmachine elasticsearchmachine added Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch labels Sep 12, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-foundations (Team:Search Foundations)

@smalyshev smalyshev requested a review from quux00 September 12, 2025 18:30
Copy link
Contributor

@astefan astefan left a comment

Choose a reason for hiding this comment

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

LGTM
Left some questions and small items, nothing major.

}

// What happens here is when we run stop on subquery, the main query will still finish.
// TODO: should we have a way to stop the main query as well?
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an interesting question.
I've looked at the other tests in this class and, to me, this looks like we are already doing the right thing in this test, meaning if the query is stopped while the remote is running, the "rest" of the query (the one that takes the sub-query results, puts them in the original query and then continues) is running until it finishes. And this is in line with what happens in test method testStopQuery in this class.

By this question you imply that when we stop the query while the remote sub-query runs, we should also stop the "rest" of the query?
OR you are referring to stopping the query AFTER the remote successfully finished (and it correctly and fully computed total value), meaning during the final execution? In which case, the results will be incomplete, but with a total value attached to them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've created a separate JIRA for this, and if it needs adjustments, we'll handle it in separate pull.

By this question you imply that when we stop the query while the remote sub-query runs, we should also stop the "rest" of the query?

I think this would be the best way to go, but we need to discuss it properly and make a decision either way. Here I'm just noting this is an open question which we don't solve with this pull.


import java.util.Iterator;
import java.util.List;
import java.util.Map;
Copy link
Contributor

Choose a reason for hiding this comment

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

I found we have a similar test for ENRICH in CrossClusterAsyncEnrichStopIT, but is there any stopping query IT test anywhere that uses a lookup join command?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure, but Lookup Join doesn't do anything really special when executing AFAIK, so not sure if it will give us more.

@smalyshev smalyshev merged commit 7d6e1e4 into elastic:main Sep 16, 2025
35 checks passed
mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Sep 17, 2025
* Make INLINESTATS (and subplans) work with CCS
gmjehovich pushed a commit to gmjehovich/elasticsearch that referenced this pull request Sep 18, 2025
* Make INLINESTATS (and subplans) work with CCS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL >enhancement :Search Foundations/CCS Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESQL: Make INLINESTATS work in CCQ

4 participants