Skip to content

Improve cardinality estimator (Part 1)#593

Merged
hartig merged 10 commits intomainfrom
585-improve-cardinality-estimator
May 4, 2026
Merged

Improve cardinality estimator (Part 1)#593
hartig merged 10 commits intomainfrom
585-improve-cardinality-estimator

Conversation

@kentthang010
Copy link
Copy Markdown
Collaborator

@kentthang010 kentthang010 commented Apr 22, 2026

First PR for #585.

This PR refactors the Filter operator (as suggested in the issue discussion thread).

It also introduces early-exit optimizations that set the cardinality to 0 with Quality.ACCURATE when the input is guaranteed to be empty. This is added for the following operators:

  • LeftJoin
  • Union
  • Dedup
  • Minus
  • Project
  • Bind
  • Unfold
  • LocalToGlobal
  • GlobalToLocal

@kentthang010 kentthang010 marked this pull request as ready for review April 23, 2026 08:58
@kentthang010 kentthang010 requested a review from hartig April 23, 2026 08:58
@kentthang010 kentthang010 changed the title Improve cardinality estimator Improve cardinality estimator (Part 1) Apr 23, 2026
@kentthang010
Copy link
Copy Markdown
Collaborator Author

kentthang010 commented Apr 23, 2026

As there is some repeated code / logic in some of these cases / operators, I can probably introduce some helper method but I will wait with it for now.

Edit: I added it

kentthang010 and others added 2 commits April 29, 2026 11:58
Co-authored-by: Olaf Hartig <olaf.hartig@liu.se>
@kentthang010 kentthang010 requested a review from hartig April 29, 2026 10:32
Copy link
Copy Markdown
Member

@hartig hartig left a comment

Choose a reason for hiding this comment

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

Just one more Javadoc comment and we can merge this PR.

@kentthang010 kentthang010 requested a review from hartig May 4, 2026 07:26
@kentthang010
Copy link
Copy Markdown
Collaborator Author

Just one more Javadoc comment and we can merge this PR.

added!

Copy link
Copy Markdown
Member

@hartig hartig left a comment

Choose a reason for hiding this comment

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

Looks good now. I will merge it.

@hartig hartig merged commit c26340e into main May 4, 2026
1 check passed
@hartig hartig deleted the 585-improve-cardinality-estimator branch May 4, 2026 08:08
hartig added a commit that referenced this pull request May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve cardinality estimator for cases in which plans produce the empty result

2 participants