-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[CALCITE-6947] Support LogicalSnapshot in RelShuttle #4620
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
base: main
Are you sure you want to change the base?
Conversation
core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
Outdated
Show resolved
Hide resolved
core/src/test/resources/org/apache/calcite/test/SqlHintsConverterTest.xml
Show resolved
Hide resolved
dssysolyatin
left a 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.
LGTM. About the discussion, I’ll start it on the mailing list when I have time (I added it to my personal to-do list, but it will be not soon). If you want to do it yourself or open a jira ticket, go ahead.
@dssysolyatin Thank you for your suggestions and help,I learned a lot! |
|
The point of having visitors is exactly so you don't have to dispatch manually based on types (LogicalSnapshot), but have the compiler do the dispatch for you. This deserves a discussion in JIRA. There are many ways to design the visitors, and I haven't seen a spec for Calcite's visitors. For example, it's not clear whether the visitor method for LogicalSnapshot is supposed to call the visitor method for superclasses. But in general, if you have a new class that extends the visited objects (LogicalSnapshot extending RelNode), all visitors must potentially be extended to cope with the new class. |
Should the implementation of the visitor be set as final or private as much as possible? However, it seems that it is currently inheritable. If modifications are made to the existing visitor, would this have an impact on forward compatibility? |
I also think it makes sense. Since it is open, it must be visible to other callers. So your suggestion is to open the RelShuttle interface for LogicalSnapshot, right? @mihaibudiu |
|
@xuzifu666 I recommend reading the comments on [CALCITE-7288] |
|
I think that the visitor should have methods for all Rel classes that are in core. |
|
@xuzifu666 I approved your PR, but it doesn’t really make sense to merge it as it is. The reason is that If you want to add a visitor method for |
|
Okay, it seems that everyone is basically in agreement, so I would add visit method to LogicalSnapshot and I would document it as a breaking change. By the way where is the appropriate place to write the breaking change document? (I haven't written this before) @dssysolyatin |
I think I clearly explained my point of view during the PR review and in [CALCITE-7288]. As long as About breaking changes, I already sent you a link with example:
|
741b0c7 to
32afefd
Compare
|
I have updated the PR and added the breaking change document. Reviews can check if it is OK. |
32afefd to
45ff89e
Compare
|
It seems OK and I had squashed the commits @mihaibudiu |
|
I personally think this is the right way to solve this problem. |
|
Until we have a solid refactoring plan, I agree with adding a |
OK,had added tests for |
|
@xuzifu666 I don’t think what you did in your last commit matches what @xiedeyantu meant. It is not so easy to write such test, although it should be possible using reflection. But before writing such a test, you need to clearly define the specification. For example, should
If you do such "temporary fix". Make sure we don’t add a new "temporary fix" with every release that includes breaking changes related to this topic. Based on HintCollector, I can say that there's an issue with |
It seems we haven't reached a consensus. If you feel this is inappropriate, should I close this PR first? @dssysolyatin |
|
I’m okay to merge this PR if: 1 The specifications for This will help us avoid forgetting new visit methods and ensure all existing methods work correctly, so any breaking changes will happen in only one release. It doesn’t matter to me if it is a separate Jira/PR or not |
|
Thanks for the explanation @dssysolyatin . Indeed, it's quite challenging to write a comprehensive test #4641 . I've drafted a general approach (still a rough sketch) – please feel free to review its feasibility. As you mentioned, we probably need to clarify which RelNode classes should have visit methods in RelShuttle and which shouldn't (those should be excluded in the test). I'm not sure if this type of test would be acceptable to the team. |
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 90 days if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions. |



jira:https://issues.apache.org/jira/browse/CALCITE-6947