Skip to content

[CALCITE-4239] RelMdUniqueKeys returns wrong unique keys for Aggregate with grouping sets - #2145

Merged
chunweilei merged 1 commit into
apache:masterfrom
chunweilei:CALCITE-4239
Sep 14, 2020
Merged

[CALCITE-4239] RelMdUniqueKeys returns wrong unique keys for Aggregate with grouping sets#2145
chunweilei merged 1 commit into
apache:masterfrom
chunweilei:CALCITE-4239

Conversation

@chunweilei

Copy link
Copy Markdown
Contributor

No description provided.

ImmutableBitSet groupKey = ImmutableBitSet.range(rel.getGroupCount());
return columns.contains(groupKey);
}
return false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we return false or null?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return null seems better(it means unknown). Thank you for your review.

return ImmutableSet.of(rel.getGroupSet());
if (Aggregate.isSimple(rel) || ignoreNulls) {
// group by keys form a unique key
return ImmutableSet.of(rel.getGroupSet());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the group set is immutable, we can directly return rel.getGroupSet()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. rel.getGroupSet() returns ImmutableBitSet while here we should return Set<ImmutableBitSet>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Thanks for the clarification.

@chunweilei chunweilei added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label Sep 11, 2020

@liyafan82 liyafan82 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing the problem.

@chunweilei
chunweilei merged commit 1ae20f3 into apache:master Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LGTM-will-merge-soon Overall PR looks OK. Only minor things left.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants