-
Notifications
You must be signed in to change notification settings - Fork 25.2k
ES|QL: pushdown LOOKUP JOIN past SORT #121884
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
Comments
Pinging @elastic/es-analytical-engine (Team:Analytics) |
Oh no, I realized there's a problem with this approach. That is: Currently, after the JOIN/MV_EXPAND, the rows that come from multiple matches/expanding a multivalue are consecutive. Is this part of the contract for JOIN/MV_EXPAND? If it is, then the approach of pushing down past a sort cannot be correct, as sorting after will break up consecutive rows that belonged to the same match/MV. Otherwise, this approach is correct but has another problem - in addition to requiring to be well documented: Some users already remarked that with If we wanted this
|
Good catch
I don't think we have a documented behavior about this, but yeah, it seems a natural implicit behavior. IMHO we should not break it, unless there is a real reason |
I think we need to decide on this contract before LOOKUP JOIN goes GA. I'll take note of it. |
Thinking more about this, while for MV_EXPAND it seems natural (one record in, N records out, as they flow), for JOIN this constraint could be a big limitation, especially if we implement generalized JOIN between indexes. |
@nik9000 pointed out that another solution would be if our |
For the record, for the near future there will be NO ordering guarantees for a various reasons (many already stated in this thread): a. it’s a two-way door, meaning we can add ordering guarantees later if we want to. the reverse is not possible |
(and potentially other commands)
Some queries cannot be executed due to unbounded sort.
Eg.
languages mapping:
will result in a
verification_exception
.Some cases though, could be fixed by pushing LOOKUP JOIN past SORT.
When there is attribute masking it's particularly challenging, as we'll have to keep a copy of the original column with a different name and then discard it, eg. the above query could be translated to
The text was updated successfully, but these errors were encountered: