[CALCITE-4241] Some improvements to metadata query - #2146
Merged
Conversation
chunweilei
reviewed
Sep 11, 2020
| return RelMdUtil.areColumnsDefinitelyUniqueWhenNullsFiltered(mq, leftRel, | ||
| return RelMdUtil.areColumnsDefinitelyUnique(mq, leftRel, | ||
| joinInfo.leftSet()); | ||
| } |
Contributor
There was a problem hiding this comment.
RelMdUtil#areColumnsDefinitelyUniqueWhenNullsFiltered has different implementation from RelMdUtil#areColumnsDefinitelyUnique. The former one would ignore null while the other one not. Why do you say they have same behavoirs?
Contributor
Author
There was a problem hiding this comment.
@chunweilei Thanks a lot for your careful review. They are different indeed.
However, areColumnsDefinitelyUniqueWhenNullsFiltered methods could be implemented in a more efficient way.
liyafan82
force-pushed
the
fly_0910_md
branch
from
September 11, 2020 08:20
dddaf5e to
9d2c0a6
Compare
chunweilei
reviewed
Sep 14, 2020
| + ") t(c1, c2, c3)"); | ||
| final RelMetadataQuery mq = rel.getCluster().getMetadataQuery(); | ||
|
|
||
| ImmutableBitSet groupKey = ImmutableBitSet.of(0, 1, 2); |
Contributor
There was a problem hiding this comment.
Could you add a test case which contains null literal?
Contributor
Author
There was a problem hiding this comment.
Sure. Cases for null literals are added. Thanks for your good suggestion.
liyafan82
force-pushed
the
fly_0910_md
branch
from
September 14, 2020 03:07
9d2c0a6 to
bb44776
Compare
chunweilei
approved these changes
Sep 15, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For {{RelMdColumnUniqueness#areColumnsUnique(RelSubset, RelMetadataQuery,
ImmutableBitSet, boolean)}}, we can return early as we encounter the first null.
For {{RelMdDistinctRowCount#getDistinctRowCount(Values, RelMetadataQuery,
ImmutableBitSet, RexNode)}}, we can get the distinct row count accurately, instead of guessing that half of the elements are distinct.
RelMdUtil#areColumnsDefinitelyUniqueWhenNullsFiltered could be implemented in a more efficient way.