Skip to content

ESQL: Document LU JOIN/MV_EXPAND not respecting SORT #127718

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
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alex-spies
Copy link
Contributor

Relates #121884.

We currently cannot run all queries that have a SORT before either LOOKUP JOIN or MV_EXPAND. This is because we cannot push down these commands past SORTs without breaking the sort order in some cases. We may or may not want to choose to push down in these cases in the future, even though this affects sort order.

Moreover, further work and generalizations of LOOKUP JOIN may be even less compatible with sorting - e.g. if we generalize lookup indices to have multiple shards residing on different nodes.

To keep all possibilities open, let's just document that we give no guarantees whatsoever; we can revisit this later when needed.

@alex-spies alex-spies requested review from costin and leemthompo May 5, 2025 16:41
@elasticsearchmachine elasticsearchmachine added Team:Docs Meta label for docs team Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) labels May 5, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-docs (Team:Docs)

@elasticsearchmachine
Copy link
Collaborator

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

@@ -45,6 +45,12 @@ results, the output will contain one row for each matching combination.
In case of name collisions, the newly created columns will override existing columns.
::::

::::{warning}
The output rows produced by `LOOKUP JOIN` can be in any order and may not
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@leemthompo , should we also place this warning in the more in-depth landing page for lookup join?

Copy link
Contributor

@leemthompo leemthompo May 5, 2025

Choose a reason for hiding this comment

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

I think we are running the risk of those two pages becoming undifferentiated and therefore hard to maintain, if we repeat everything in both. Also adding admonitions like this doesn't scale.

We could consider moving this warning and the tip above it into the landing page under a new heading like Usage notes. And then we can link to that new section of the landing page from here with a message like "Refer to Usage notes for important information about using the LOOKUP JOIN command"— instead of repeating admonitions on both pages. This will be cleaner, more future-proof, and easier to maintain.

WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >docs General docs changes Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Docs Meta label for docs team v8.18.1 v8.19.0 v9.0.1 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants