Skip to content

ESQL: introduce a pre-mapping logical plan processing step #121260

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
merged 32 commits into from
Jan 31, 2025

Conversation

bpintea
Copy link
Contributor

@bpintea bpintea commented Jan 30, 2025

This adds a pre-mapping logical plan processing step, occurring after the logical optimisation, but before mapping it to a physical plan. This step can perform async actions, if needed, and involves using a new TransportActionServices record with all available services.

Furthermore, the query rewriting step part of the FullTextFunctions planning (occurring on the coordinator only) is refactored a bit to update the queries in-place.
The verification done by Match and Term involving checking on the argument type is also now pulled back from post-optimisation to post-analysis. Their respective tests are moved accordingly as well.

@bpintea bpintea added >refactoring auto-backport Automatically create backport pull requests when merged :Analytics/ES|QL AKA ESQL v9.0.0 v8.18.0 labels Jan 30, 2025
Copy link
Member

@costin costin left a comment

Choose a reason for hiding this comment

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

LGTM

return indexNames;
}

private record FullTextFunctionsRewritable(LogicalPlan plan) implements Rewriteable<QueryBuilderResolver.FullTextFunctionsRewritable> {
Copy link
Member

Choose a reason for hiding this comment

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

Nit:
While this pattern (of using record) works, it's somewhat misleading - instead use a closure to encapsulate the method directly at the calling site to reference the plan:

Rewriteable<QueryBuilderResolver.FullTextFunctionsRewritable> closure = c -> {
  ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A nice proposal, but I'd like to keep it separated, just to maintain the legibility of that method (which would otherwise grow quite a bit).

@bpintea bpintea changed the title ESQL: apply FullTextFunction query rewriting in-place ESQL: introduce a pre-mapping logical plan processing step Jan 30, 2025
Copy link
Member

@carlosdelest carlosdelest left a comment

Choose a reason for hiding this comment

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

LGTM !

bpintea and others added 10 commits January 31, 2025 09:46
…lastic#121318)

AggregateMetricDouble should be behind a feature flag but on release
builds it was getting added when it should not have been. This commit
addresses that bug.
…=reference/snapshot-restore/apis/get-snapshot-api/line_751} elastic#121345
…lastic#121325)

Assertion was using reference equality on two boxed longs. So assertion could produce false positives. Change to Objects.equals to check value and avoid null check.
…eIT test {yaml=search.vectors/42_knn_search_int4_flat/Vector similarity with filter only} elastic#121350
* Integrate watsonx reranking to inference api

* Add api_version to the watsonx api call

* Fix the return_doc option

* Add top_n parameter to task_settings

* Add truncate_input_tokens parameter to task_settings

* Add test for IbmWatonxRankedResponseEntity

* Add test for IbmWatonxRankedRequestEntity

* Add test for IbmWatonxRankedRequest

* [CI] Auto commit changes from spotless

* Add changelog

* Fix transport version

* Add test for IbmWatsonxService

* Remove canHandleStreamingResponses

* Add requireNonNull for modelId and projectId

* Remove maxInputToken method

* Convert all optionals to required

* [CI] Auto commit changes from spotless

* Set minimal_supported version to be ML_INFERENCE_IBM_WATSONX_RERANK_ADDED

* Remove extraction of unused fields from IbmWatsonxRerankServiceSettings

* Add space

* Add space

---------

Co-authored-by: elasticsearchmachine <[email protected]>
@bpintea bpintea added auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) and removed auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) labels Jan 31, 2025
@bpintea bpintea merged commit 0393e56 into elastic:main Jan 31, 2025
17 checks passed
@bpintea bpintea deleted the enh/mapping_pre_processor2 branch January 31, 2025 10:39
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.x Commit could not be cherrypicked due to conflicts

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

bpintea added a commit to bpintea/elasticsearch that referenced this pull request Jan 31, 2025
…21260)

This adds a pre-mapping logical plan processing step, occurring after the logical optimisation, but before mapping it to a physical plan. This step can perform async actions, if needed, and involves using a new `TransportActionServices` record with all available services.

Furthermore, the query rewriting step part of the `FullTextFunction`s planning (occurring on the coordinator only) is refactored a bit to update the queries in-place.
The verification done by `Match` and `Term` involving checking on the argument type is also now pulled back from post-optimisation to post-analysis. Their respective tests are moved accordingly as well.

(cherry picked from commit 0393e56)
elasticsearchmachine pushed a commit that referenced this pull request Jan 31, 2025
…121382)

This adds a pre-mapping logical plan processing step, occurring after the logical optimisation, but before mapping it to a physical plan. This step can perform async actions, if needed, and involves using a new `TransportActionServices` record with all available services.

Furthermore, the query rewriting step part of the `FullTextFunction`s planning (occurring on the coordinator only) is refactored a bit to update the queries in-place.
The verification done by `Match` and `Term` involving checking on the argument type is also now pulled back from post-optimisation to post-analysis. Their respective tests are moved accordingly as well.

(cherry picked from commit 0393e56)
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 backport pending >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.19.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants