Skip to content

ESQL: LOOKUP JOIN push down optimizations #119082

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

Open
alex-spies opened this issue Dec 19, 2024 · 2 comments · May be fixed by #127776
Open

ESQL: LOOKUP JOIN push down optimizations #119082

alex-spies opened this issue Dec 19, 2024 · 2 comments · May be fixed by #127776
Assignees
Labels
:Analytics/ES|QL AKA ESQL >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)

Comments

@alex-spies
Copy link
Contributor

alex-spies commented Dec 19, 2024

Compared to ENRICH (and other, similar plans like GROK, DISSECT and EVAL), we do not push down LOOKUP JOINs.

That leads to suboptimal plans, e.g. because projections before and after the LOOKUP JOIN cannot be combined.

Example:

              FROM test
            | LOOKUP JOIN lookup_index1 ON field
            | RENAME foo AS b
            | LOOKUP JOIN lookup_index2 ON field
            | DROP b*

The RENAME foo AS b in between the LOOKUP JOINs becomes an EsqlProject, which cannot be combined with the EsqlProject that comes from the DROP b* because the LOOKUP JOIN lookup_index_2 is in the way. As a result, we cannot determine that the field foo obtained from the lookup_index1 is actually dropped and unused in the end.

Edit: Let's also double check that there are no other existing optimizer rules that could (somewhat) easily be applied to LOOKUP JOIN.

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Dec 19, 2024
@elasticsearchmachine
Copy link
Collaborator

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

@alex-spies
Copy link
Contributor Author

Before closing this issue, let's also double check that there are no other existing optimizer rules that could (somewhat) easily be applied to LOOKUP JOIN. (If this ends up expanding the scope too much, we can track this in a separate issue once we find out more.)

@alex-spies alex-spies self-assigned this Apr 29, 2025
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 Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants