-
Notifications
You must be signed in to change notification settings - Fork 25k
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
ESQL: Reorganize optimizer rules #112338
ESQL: Reorganize optimizer rules #112338
Conversation
Thanks for looking into this. So the final structure looks something like:
+1 on the separating the utils - even better make them protected. |
The inheritance was completely trivial.
a778aa9
to
5148356
Compare
Pinging @elastic/es-analytical-engine (Team:Analytics) |
@costin, the structure is now the one you suggested + I made the new utils package private. |
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
|
||
import static org.elasticsearch.xpack.esql.common.Failure.fail; | ||
|
||
public class DependencyConsistency<P extends QueryPlan<P>> { |
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 name should indicate the role of this class - checking the consistency of dependencies. Right now it sounds like a DTO class which contains the dependencies consistency.
How about something more mundane but clearer such as DependencyChecker
, PlanStateChecker
or ValidatePlanState
?
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.
This class was just extracted from an already existent one, but it wouldn't hurt a rename tbh.
Thinking about the name, I realized we don't have a javadoc for it to explain its intention. How about adding a sentence there?
Leaving the javadoc aside and just looking at the code, I am throwing another name suggestion in the bucket, but up to @alex-spies to make the change or not altogether: PlanConsistencyChecker
(the reasoning behind the name is that this is a checker class and does something, an action; it looks at the "inputs" and "outputs" of each node plan if there is an inconsistency there it spits out an error, thus the PlanConsistency
part). My 2c.
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 went with Andrei's suggestion :)
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. Thanks, Alex.
I've left some comments mostly spawning from personal preferences and experience. Feel free to adopt or ignore them.
...in/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/LocalPhysicalPlanOptimizer.java
Outdated
Show resolved
Hide resolved
...k/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/LogicalPlanOptimizer.java
Show resolved
Hide resolved
|
||
import static org.elasticsearch.xpack.esql.common.Failure.fail; | ||
|
||
public class DependencyConsistency<P extends QueryPlan<P>> { |
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.
This class was just extracted from an already existent one, but it wouldn't hurt a rename tbh.
Thinking about the name, I realized we don't have a javadoc for it to explain its intention. How about adding a sentence there?
Leaving the javadoc aside and just looking at the code, I am throwing another name suggestion in the bucket, but up to @alex-spies to make the change or not altogether: PlanConsistencyChecker
(the reasoning behind the name is that this is a checker class and does something, an action; it looks at the "inputs" and "outputs" of each node plan if there is an inconsistency there it spits out an error, thus the PlanConsistency
part). My 2c.
Closes #111317
Organize the optimizer rules consistently for all 4 optimizers (logical, physical, local logical, local physical) and move helper methods meant for optimizer rules out of the optimizers into the relevant rules or into helper classes. Make the optimizers now only contain code relevant to the actual optimizer definition, i.e. which batches of rules they use.
Also, consolidate the 2 nearly identical logical
ParameterizedRule
s into one.New package structure:
New helper classes: