-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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
For empty mappings use a LocalRelation #105081
For empty mappings use a LocalRelation #105081
Conversation
no data present), convert the logical plan to a local relation
…local_execution_on_empty_mapping
c7b3288
to
89f5c36
Compare
Hi @astefan, I've created a changelog YAML for you. |
Pinging @elastic/es-analytical-engine (Team:Analytics) |
@elasticsearchmachine run elasticsearch-ci/part-1 |
@elasticmachine run elasticsearch-ci/part-1 |
@elasticmachine update branch |
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.
LGTM
// marker list of attributes for plans that do not have any concrete fields to return, but have other computed columns to return | ||
// ie from test | stats c = count(*) |
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.
👍
@@ -154,7 +154,8 @@ protected static List<Batch<LogicalPlan>> rules() { | |||
new SubstituteSurrogates(), | |||
new ReplaceRegexMatch(), | |||
new ReplaceNestedExpressionWithEval(), | |||
new ReplaceAliasingEvalWithProject() | |||
new ReplaceAliasingEvalWithProject(), | |||
new SkipQueryOnEmptyMappings() |
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.
Why not part of the skip
batch? It'd be worth a comment if there's a reason.
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.
Because this can be determine upfront, which facilitates the rest of the rules and folding of LocalRelation through-out the plan.
Skip is done at the end for cases where a normal relationship is changed due to filtering.
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 does make the other rules do less work, yes, but since there's a ONCE
limiter, it might then have made more sense as a first rule. Anyways, minor.
@@ -139,7 +140,7 @@ public void init() { | |||
|
|||
private Analyzer makeAnalyzer(String mappingFileName, EnrichResolution enrichResolution) { | |||
var mapping = loadMapping(mappingFileName); | |||
EsIndex test = new EsIndex("test", mapping); | |||
EsIndex test = new EsIndex("test", mapping, Set.of("test")); |
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.
With all the similar changes to add a concrete index, wondering if EsIndex(String name, Map<String, EsField> mapping)
c'tor, which is only used in tests, shouldn't be updated instead to add a set with the name
.
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 have mixed feelings about this. I know it's not a big deal, but if something is used only in tests, the method/constructor access modifier should reflect this. But this class is used in many different packages and the only possible access modifier is public
. I would rather have the usage be explicit and the user of the constructor be aware of the implications of providing an empty Set or specific values in that Set, rather than use the constructor without being aware of its content.
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.
LGTM
That's interesting, I wasn't aware of this scenario. Thank you for the awareness ping.
|
…local_execution_on_empty_mapping
…local_execution_on_empty_mapping
Fixes #104809 by converting a plan to a local relation when there is no mapping for the index pattern.