Skip to content

push down filter: consider already pushed filters #8

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

Merged
merged 1 commit into from
Jun 10, 2025

Conversation

askalt
Copy link

@askalt askalt commented Jun 9, 2025

If optimizer runs several times it can try to push filters into table provider several times. But, supports_filters_pushdown may be context-dependent. For example, it may support any filter like column=value but not the both at the same time.

Consider the following optimizer run:

  1. Try to push a = 1, b = 1. supports_filters_pushdown returns [Exact, Inexact] Ok, will remember that a=1 is pushed and make a filter node for b=1.

...
Another optimization iteration.

  1. Try to push b = 1. supports_filters_pushdown returns [Exact]. Of course, the table provider can't remember all pushed filters. So, there is nothing to left but to answer: "Exact". Now, the optimizer thinks that conjunction a = 1 AND b = 1 is supported exactly, but it's not.

To prevent this problem, this patch adds already pushed filters to the supports_filters_pushdown call.

@askalt askalt force-pushed the askalt/push-already-pushed-filters branch from 399cf94 to c21fd06 Compare June 9, 2025 13:55
If optimizer runs several times it can try to push filters into
table provider several times. But, `supports_filters_pushdown`
may be context-dependent. For example, it may support any filter
like `column=value` but not the both at the same time.

Consider the following optimizer run:

1. Try to push `a = 1, b = 1`.
   `supports_filters_pushdown` returns [Exact, Inexact]
   Ok, will remember that `a=1` is pushed and make a filter node for `b=1`.

...
Another optimization iteration.

2. Try to push `b = 1`.
   `supports_filters_pushdown` returns [Exact]. Of course, the
   table provider can't remember all pushed filters. So, there is nothing
   to left but to answer: "Exact".
   Now, the optimizer thinks that conjunction `a = 1 AND b = 1` is supported
   exactly, but it's not.

To prevent this problem, this patch adds already pushed filters to the
`supports_filters_pushdown` call.
@askalt askalt force-pushed the askalt/push-already-pushed-filters branch from c21fd06 to 3b3b5d1 Compare June 10, 2025 07:53
@askalt askalt merged commit 47d8edc into release-42.0.0 Jun 10, 2025
41 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants