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-4779] GroupByList contains constant literal, materialized view recognition failed #2529
Conversation
@julianhyde |
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.
The PR LGTM, I was thinking that tests could cover also constants between column names, and after them, instead of only preceding them.
For instance something like: group by $col1, 1, $col2
, group by 1, $col1, $col2
and group by 1, $col1, $col2
core/src/test/java/org/apache/calcite/test/MaterializedViewSubstitutionVisitorTest.java
Outdated
Show resolved
Hide resolved
1debc97
to
068acd4
Compare
LGTM~ |
core/src/test/java/org/apache/calcite/test/MaterializedViewSubstitutionVisitorTest.java
Outdated
Show resolved
Hide resolved
Can you use a varchar constant, not integer constant in the group by list. |
068acd4
to
9916a7b
Compare
@xy2953396112 please avoid squashing while the review process is on-going, old and new changes cannot be distinguished anymore, and reviewers can't just look at the "newer" part. |
ok.Please review again,thanks. |
|
ok.Please help review, thanks a lot. |
As a general comment, test cases should be crafted with the expected behaviour in mind, not the concrete implementation. It might seem trivial in the current state of the implementation, but tomorrow a change could break this assumption (maybe simply by mistake), and the test case would capture it. Of course there must be a reasonable chance for this to happen, I am not saying that this is necessarily the case here. |
9916a7b
to
4141459
Compare
I second @asolimando's point about merging. When a PR is under review, don't rebase (unless asked to), don't squash commits, don't amend commits, just add new commits. It makes things easier for reviewers. We know how to do I think it would be useful if you describe in brief a javadoc sentence the particular feature that each each test is testing. It's difficult to capture this in the test name - for example, the test case "testGroupSetMultipleLiteralsOrder" contains neither I'm not sure that this bug requires 70 lines of new tests, because the fix simply removes literals. Since all tests use the same MV, I would compress them all into one method. The one case you have not tested is a query that groups by a literal and no columns, e.g. |
Ok, got it. Thanks for for your advice. @asolimando |
e6ef436
to
b47a264
Compare
@yanlin-Lynn @julianhyde @asolimando |
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 re-confirm my approval after checking the latest changes, thanks for addressing the comments!
1e82bbd
to
ba3bcab
Compare
Thanks for review. |
048fd15
to
7814935
Compare
/** Test case for | ||
* <a href="https://issues.apache.org/jira/browse/CALCITE-4779">[CALCITE-4779] | ||
* GroupingSet contains {@link RexLiteral}, materialized view recognition failed</a>. */ | ||
@Test void testGroupingSetLiteral() { |
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.
It's not grouping set, it's "constant literal" in group by list. right?
7814935
to
fd2fa0c
Compare
@@ -1691,6 +1691,44 @@ private void checkSatisfiable(RexNode e, String s) { | |||
+ "EnumerableTableScan(table=[[hr, MV0]])")).ok(); | |||
} | |||
|
|||
/** Test case for | |||
* <a href="https://issues.apache.org/jira/browse/CALCITE-4779">[CALCITE-4779] | |||
* GroupSet contains {@link RexLiteral}, materialized view recognition failed</a>. */ |
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.
Not GroupSet, it's group by list
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.
ok
final String mv1 = "" | ||
+ "select \"deptno\", \"empid\"\n" | ||
+ "from \"emps\"\n" | ||
+ "group by \"deptno\", \"empid\""; |
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.
mv0 and mv1 is the same.
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.
thanks,update the code.
…ew recognition failed (xzh)
fd2fa0c
to
b3d6774
Compare
LGTM |
https://issues.apache.org/jira/projects/CALCITE/issues/CALCITE-4779