-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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-3182] Trim unused fields for plan of materialized-view before matching. #1307
Conversation
core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/apache/calcite/test/MaterializationTest.java
Outdated
Show resolved
Hide resolved
@DonnyZone |
As CALCITE-3113 is already resolved by |
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
@rubenada |
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.
+1
THX @DonnyZone |
@jinxing64 could you please update the commit message and add your "name in parentheses at the end of the message" (as described in the contributing guidelines) |
…e matching (Jin Xing)
@rubenada |
@rubenada |
What changes were proposed in this pull request?
In current code, before matching query with materialized-view, unused fields of query is trimmed but materialized-view is not. Thus below simple SQL fails to be matched though query and materialized-
view are exactly the same:
Checking
CalciteMaterializer
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/prepare/CalciteMaterializer.java#L83 , I think the code intends to do the trimming, but didn't call the method.Since unused fields of query is trimmed anyway https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java#L995 , thus I think there's no necessity to keep the materialized-view un-trimmed
How was this patch tested?
Added new test.