Skip to content
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-4208] Improve metadata row count for Join #2131

Merged
merged 1 commit into from
Sep 5, 2020

Conversation

rubenada
Copy link
Contributor

@rubenada rubenada commented Sep 2, 2020

Currently, the default metadata row count for join RelMdRowCount#getRowCount(Join rel, RelMetadataQuery mq) relies on RelMdUtil.getJoinRowCount. This method has several issues:

  • In case of ANTI join, it returns the same estimation as a SEMI join
  • In other cases (INNER, LEFT, RIGHT, FULL), it returns always the same formula:
    leftRowCount * rightRowCount * mq.getSelectivity(join, condition)
    which seems valid for an INNER join, but not for LEFT / RIGHT / FULL.

The goal of this patch is fixing the ANTI computation and providing a more accurate value for LEFT / RIGHT / FULL.

Copy link
Contributor

@amaliujia amaliujia left a comment

Choose a reason for hiding this comment

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

LGTM

@rubenada rubenada added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label Sep 4, 2020
@rubenada rubenada merged commit 7353fa9 into apache:master Sep 5, 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. slow-tests-needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants