-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Add Lookup#resolveGroup method and make Lookup#resolve depricated #8698
Conversation
@martint your opinion would be appreciated |
I would refrain with this for a while as I have some doubts if the fact that memo holds multiple nodes per group should be exposed to rules. Why not to work on traits? This would be helpful even with current memo and rules implementation. We could port |
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.
As I said, lets wait a bit with this.
71c6489
to
9f962ec
Compare
That is the intention of this PR. We already rely on singleton After this PR lands it opens multiple parallel/independent tasks:
I think this PR is next logical step in order to continue optimizer since we slowly want to divert from |
@@ -28,7 +30,7 @@ | |||
* If the node is not a GroupReference, it returns the | |||
* argument as is. | |||
*/ | |||
PlanNode resolve(PlanNode node); | |||
List<PlanNode> resolve(PlanNode node); |
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.
Instead of changing this method, I would deprecate it and add a new method resolveGroup
which would be used to implement this method.
In the future, equivalence based memo would store multiple plan nodes per group. Therefore resolve() that returns singleton should be unused.
9f962ec
to
535f940
Compare
applied comment |
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.
minor comments
@@ -28,7 +31,20 @@ | |||
* If the node is not a GroupReference, it returns the | |||
* argument as is. | |||
*/ |
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.
please update javadoc
@@ -76,7 +76,7 @@ public PlanNode optimize(PlanNode plan, Session session, Map<Symbol, Type> types | |||
} | |||
|
|||
Memo memo = new Memo(idAllocator, plan); | |||
Lookup lookup = Lookup.from(memo::resolve); | |||
Lookup lookup = Lookup.from(planNode -> ImmutableList.of(memo.resolve(planNode))); |
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 would use Collections.singletonList()
instead of ImmutableList.of
with single argument. But up to you.
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.
ImmutableList.of()
plays better with ImmutableList.copyOf
.
In the future, equivalence based memo would
store multiple plan nodes per group. Therefore
resolve() that returns singleton should be unused.
This is part of ongoing effort to introduce equivalence based memo and exploratory optimizer: #7169
It is natural step after
Support simple pattern matching with captures
that makes rule interface compatible with equivalence based memo.FYI @martint @kokosing