-
Notifications
You must be signed in to change notification settings - Fork 2.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
[CALCITE-5756] Expand ProjectJoinRemoveRule to support inner join remove by the foreign-unique constraint in the catalog #3264
base: main
Are you sure you want to change the base?
Conversation
core/src/main/java/org/apache/calcite/rel/metadata/BuiltInMetadata.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/BuiltInMetadata.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/BuiltInMetadata.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/RelMdForeignKeys.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/RelMdForeignKeys.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/RelMdForeignKeys.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/RelMdForeignKeys.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/RelMdForeignKeys.java
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/RelMdForeignKeys.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/RelMdForeignKeys.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/RelMdForeignKeys.java
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/RelMetadataQuery.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/RelMetadataQuery.java
Outdated
Show resolved
Hide resolved
testkit/src/main/java/org/apache/calcite/test/catalog/MockCatalogReaderSimple.java
Show resolved
Hide resolved
testkit/src/main/java/org/apache/calcite/test/catalog/MockCatalogReaderSimple.java
Show resolved
Hide resolved
testkit/src/main/java/org/apache/calcite/test/catalog/MockCatalogReaderSimple.java
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/rules/ProjectJoinRemoveRule.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/rules/ProjectJoinRemoveRule.java
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/rules/ProjectJoinRemoveRule.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/rules/ProjectJoinRemoveRule.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/rules/ProjectJoinRemoveRule.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/rules/ProjectJoinRemoveRule.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/rules/ProjectJoinRemoveRule.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/rules/ProjectJoinRemoveRule.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/rules/ProjectJoinRemoveRule.java
Outdated
Show resolved
Hide resolved
testkit/src/main/java/org/apache/calcite/test/RelMetadataFixture.java
Outdated
Show resolved
Hide resolved
testkit/src/main/java/org/apache/calcite/test/RelMetadataFixture.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
Outdated
Show resolved
Hide resolved
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, lots of minor comments and some missing tests but the PR is in good shape and the contribution is very valuable, will get there in few iterations, thanks @JingDas for your work!
Almost forgot: the commit message must match the title of the Jira ticket, at the moment they are different |
@JingDas thanks for addressing the comments, I am on a business trip at the moment, I should be able to review again by the end of this week. FYI: when you are done with comments and you want the reviewers to take another look you can also use the "request review" button close to the reviewers' name in the top-right part of the GitHub page |
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 have reviewed your changes, I have some further comments but we are converging.
I'd ask you the favour of not resolving comments on your side, as it makes it very tricky for me to track if what was asked has been addressed or not, I will mark them as resolved myself, thanks!
core/src/main/java/org/apache/calcite/rel/metadata/BuiltInMetadata.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/BuiltInMetadata.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/RelMdForeignKeys.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/RelMdForeignKeys.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/RelMetadataQuery.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/rules/ProjectJoinRemoveRule.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/rules/ProjectJoinRemoveRule.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/rules/ProjectJoinRemoveRule.java
Outdated
Show resolved
Hide resolved
testkit/src/main/java/org/apache/calcite/test/RelMetadataFixture.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/rel/metadata/RelMdForeignKeys.java
Show resolved
Hide resolved
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, can you squash your changes and make sure the only commit has [CALCITE-5756] Expand ProjectJoinRemoveRule to support inner join removal by using the foreign-unique constraints
matching the commit message like the associated Jira ticket?
I will merge in the next 24 hours if no objections arise.
As a side note, avoid rebasing (or squashing) until the very end of the review as it makes it harder to check changes incrementally.
Adding "request review" from another committer given the comments in the associated Jira ticket. |
The |
Thanks @JingDas, I will review again as soon as I have some time. In the meantime, I have approved the pending workflows, but I have also noticed that there are 18 code smells detected by SonarCloud, could you do a pass on this list and fix whatever can be reasonably fixed? As for any automatic tool not everything makes sense and there might even be false positives. |
|
Sorry, it was closed by mistake,I reopen it and fixed the most necessary SonarCloud detected code. |
I some confusion about the failed results of the CI tests.
In RelOptFixture.java:397 it throw the exception. |
Aha! It seems calcite main code change, And the CI seems to use the new main logic. I will fix it according to main code usage. |
Have fixed it. |
…ove by the foreign-unique constraint in the catalog
Kudos, SonarCloud Quality Gate passed! |
This PR was approved, but never merged. What's the plan? |
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.
@mihaibudiu, discussion in the associated Jira ticket led to creating CALCITE-5881, which needs to be addressed before getting this in, unfortunately there was no progress on it for a long time now. I will remove the approval to make the situation clearer, thanks for the reminder.
This feature is mainly about expanding ProjectJoinRemoveRule to support inner join remove
by the foreign-unique constraint in the catalog.
The main steps are as follows:
RelMetadataQuery#getForeignKeys(newly add, similar to RelMetadataQuery#getUniqueKeys),
RelOptTable#getReferentialConstraints.
Test cases are added to RelOptRulesTest and RelMetadataTest.