-
Notifications
You must be signed in to change notification settings - Fork 590
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
refactor(optimizer): make ExprVisitor an object safe trait. #13512
refactor(optimizer): make ExprVisitor an object safe trait. #13512
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #13512 +/- ##
==========================================
+ Coverage 68.37% 68.42% +0.04%
==========================================
Files 1511 1511
Lines 259862 259798 -64
==========================================
+ Hits 177692 177756 +64
+ Misses 82170 82042 -128
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
-
Is
merge
andResult
really a good practice of a visitor pattern? As allvisit
methods take&mut self
, this seems to imply that one should maintain the states or results inself
. In this way, the signature ofmerge
could be likefn merge(&mut self, b: Self::Result);
Or rather, we should never have a
merge
function? -
Once a method is overridden, users have to duplicate the default implementation there and
merge
does not help us for boilerplate reduction. Will this work somehow related to optimizer: what's the "correct" form of visitor? #13477?
Although some visitors, such as Has, can easily eliminate the need for merge by using a state, other visitors, like TableScanIoEstimator, might find it challenging to calculate the cost by visiting expressions with the use of only a state, because expressions structure also matters. Therefore, I believe this method still serves a purpose. However, I agree that using &mut self instead of &self for merge would be more appropriate. |
As mentioned above, I think |
Actually I suggest we either... 🥵
|
I prefer to remove |
But as I mentioned before without a return type and merge function, visitors like |
cc @BugenZhao I removed the |
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 for doing this refactoring!
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.
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
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
fn merge
.Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.