[CALCITE-6249] RelNode::estimatedRowCount should not be used in computeSelfCost#3674
Conversation
|
|
LGTM |
|
This looks fine, but no test is affected, so it's hard to gauge the actual impact of this change. |
| final RelMetadataQuery mq) { | ||
| double rowCount = mq.getRowCount(this); | ||
|
|
||
| final double rightRowCount = right.estimateRowCount(mq); |
There was a problem hiding this comment.
Can we please write a test for this? If it shouldn't be used then a test would be helpful to show why, and how this commit corrects that.
|
@mihaibudiu this change is subtle, but it has an impact (although we do not see it in Calcite tests). By default, this change will have zero effect, because Calcite's default implementation of However, the fact of using So all these calls to @tanclary @JiajunBernoulli Writing tests for these changes is possible, but cumbersome. See e.g. the recent commit f7069cc which performed a similar change in one location, and how "artificial" it was to show the impact on a unit test. |
|
Thanks @rubenada for your detailed explanation. |
asolimando
left a comment
There was a problem hiding this comment.
LGTM too even without additional tests
What is the existing test that verifies the behavior impacted by this PR? The title says something should not be used, but there is no test to tell me that the claim of the JIRA case is true or has been fixed by this PR. If it is hard to write a test, perhaps we should work on improving the appropriate test fixture, rather than neglecting testing altogether. |
In the current code base, |
A javadoc and a JIRA case don't have any impact on the execution of certain code though. I'm not trying to block this commit from getting merged, I just don't think it's good practice to make changes without adding tests, especially when there's no existing tests. Calcite's test suite is extensive, there are test classes and fixtures for every issue I've come across. If there's not a good way to write a test, I think the solution is to make test-writing easier, not to ignore it. |
|
@tanclary , I think what @kramerul means is that there are many tests that go trough the Calcite's metadata logic and cost computation (basically every test where a query is executed via VolcanoPlanner), and the fact that all these tests are still working is a sign that this change introduces no regression (as expected), with the advantage of allowing metadata pluggability in downstream projects. |
Like I said, I'm not trying to block this. If you want to merge it please feel free. What I'm saying is that "it didn't break anything" isn't a good reason to not write tests. I also don't think "writing a test is hard" is a good reason to not write a test. That's just my opinion you can of course choose to ignore it. |
|
I understand your point of view and I appreciate your comments @tanclary , and I also appreciate the fact that your intention is not to block this. As I said before, exceptionally, I think we can merge the current PR as it is. Since we have 3 committers who have approved/LGTM'ed, and no explicit veto or -1; I propose to merge the PR, if no further comment (or veto) appears in the next 48h. |
|
That would be great @caicancai . |

No description provided.