-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Refactor verifiers and add remote check #134168
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d777561
Add check that remote enrich stays on remote side
smalyshev a93438f
Merge branch 'main' into remote-enrich-check
smalyshev b6244e5
Make it more generic
smalyshev a787ae8
[CI] Auto commit changes from spotless
6d638be
Verifier refactor
smalyshev 95ef823
Merge branch 'main' into remote-enrich-check
smalyshev 2490f60
Merge branch 'main' into remote-enrich-check
smalyshev 4e16026
Fix the fix for https://github.com/elastic/elasticsearch/issues/118531
smalyshev 932315f
Merge branch 'main' into remote-enrich-check
smalyshev ff5cabd
[CI] Update transport version definitions
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heya, you can't really know that but we're in the process of improving the planning of lookup joins. We made
LokoupJoinExec
generally contain aFragmentExec
in the right hand branch. So this check is wrong in case of upstream (remote) lookup joins.I'd add a test for this case, and I think we need to go and ignore fragments that belong to lookup joins. One way to do that is to additionally traverse the fragment and ensure its
EsRelation
is not in lookup mode.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, you could extract the "leftmost leave" by calling
collectLeaves
and checking only the first leaf. This is the main source of the plan if the plan is made only from unary and binary execs, because our binary execs have the "special" side on the right.I also realized there can be a
MergeExec
which indicates that we're after aFORK
. That'd also be wrong for a remote enrich as the merge part of a fork is executed on the coordinator.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if we see
LokoupJoinExec
aren't we on the coordinator side already anyway?Can there be
MergeExec
without fragment? From what I'm seeing, both branches of the MergeExec eventually have fragments, so we'd still reach it anyway.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, I am starting to suspect we should never see
EnrichExec
with remote mode in global plan regardless of anything else (though we might in the local plan) but I am not 100% sure yet, and also not sure how do I even know is it a local or a global plan. But checking for FragmentExec seems to be a reasonable proxy for "is this a global plan?", not?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Here's an example in our tests.
I'm not super familiar with FORK/Merge but I see from
Mapper.java
that each branch is just planned normally. There are plans without fragments, likeROW
.Which reminds me that I don't know how we handle remote ENRICH with ROW. Pathological example, though :)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It used to, but we're having more complex plans now. Lookup joins contain fragments in the right branch.
I think it's more reliable to check for a local plan by walking the plan to the leaf and checking that it is a
EsQueryExec
. In case of joins or merges, there will be more than one leaf - but I think the best current condition is "there is exactly oneEsQueryExec
, and it's the leftmost leaf".If our plans grow in complexity, we might have to explicitly mark them as data node plan, lookup index plan, coordinator plan etc. This is knowledge that is really easier to write into the plan than reverse engineer from its shape.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remote Enrich is not allowed after FORK right now, so
MergeExec
can not appear under remote Enrich I think.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this query:
and I get this plan:
Which does not have any fragments inside the join (and in fact doesn't even have EnrichExec). And this particular verifier does not seem to be called on the local part of the plan? Is there some unmerged parts that I need to test with?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plan you posted is the coordinator physical plan. There is also the data node physical plan. The physical verifier runs against both.
I checked out your branch and ran this query, then had a look at the trace logs. It shows a LookupJoinExec with a FragmentExec as right child: