-
Notifications
You must be signed in to change notification settings - Fork 2.5k
RelNodeVisitCoverageTest for test RelShuttle visit coverage #4641
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
Conversation
|
|
||
| /** | ||
| * Discovers every concrete {@link RelNode} implementation on the classpath and | ||
| * verifies {@link RelShuttle} declares a compatible {@code visit} method. |
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.
verifies whether
| */ | ||
| class RelNodeVisitCoverageTest { | ||
|
|
||
| @Test void relShuttleCoversAllRelNodes() { |
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.
so what's the result of the test?
The JavaDoc of the base shuttle should probably list the rules for a class to be visited; otherwise we will be arguing forever.
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 is a work in progress. The current logic can obtain the set of all classes that inherit from RelNode, as well as the set of all classes visited in RelShuttle. The current test only compares whether these two sets are equal. We might also need a criterion to determine which classes should be included in the visit and which classes should be excluded.
|
This is a minor suggestion for adding tests to #4620. I don't currently plan to implement it myself. |
|
This test only checks that |
|
@dssysolyatin Yes, it does seem challenging to write this test. As an alternative, could we first perform a manual audit to check if all necessary RelNode classes have implemented the visit method? If the audit confirms they do, would it be acceptable to merge that PR #4620 first? Because it is indeed a defect. |
@dssysolyatin This is indeed a problem. Do you agree with this suggestion? |
|
It’s fine with me if we just check that But before checking, it’s still necessary to figure out which node types
I would prefer to avoid breaking changes across multiple releases. If we merge |
@dssysolyatin Thank you for your reply and explanation. I will temporarily close this test PR for now, as this test doesn't seem very practical to implement. Even if we were to create a comprehensive test, its sole purpose would be to remind contributors not to forget the visit method, which seems like a disproportionate effort for the benefit gained. So I'll close this PR for now and wait to see if someone can propose a better solution in the future. |
This test is just a general approach and not fully implemented. It can help detect whether classes inheriting from RelNode have corresponding visit methods in RelShuttle. However, it introduces a dependency, and I haven't thought of a cleaner implementation approach yet.