Skip to content

Conversation

lnkuiper
Copy link
Contributor

Fixes https://github.com/duckdblabs/duckdb-internal/issues/4742

We did not recurse into nested conjunction AND expressions, causing us to bail on using an Index Scan, even though this would be much faster than the Sequential Scan.

@lnkuiper lnkuiper requested a review from taniabogatsch April 29, 2025 09:05
Copy link
Contributor

@taniabogatsch taniabogatsch left a comment

Choose a reason for hiding this comment

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

Hi, @lnkuiper, cool! - I've added some comments/thoughts. :)

@duckdb-draftbot duckdb-draftbot marked this pull request as draft April 29, 2025 13:19
@lnkuiper lnkuiper marked this pull request as ready for review April 29, 2025 13:23
@Mytherin
Copy link
Collaborator

Thanks for the PR! LGTM - could you just fix the failing vector sizes test?

@duckdb-draftbot duckdb-draftbot marked this pull request as draft May 1, 2025 10:24
@lnkuiper lnkuiper marked this pull request as ready for review May 1, 2025 10:25
@Mytherin Mytherin merged commit 4560196 into duckdb:main May 1, 2025
49 checks passed
krlmlr added a commit to duckdb/duckdb-r that referenced this pull request May 18, 2025
Extract expressions from nested conjunction AND for index scan (duckdb/duckdb#17297)
krlmlr added a commit to duckdb/duckdb-r that referenced this pull request May 18, 2025
Extract expressions from nested conjunction AND for index scan (duckdb/duckdb#17297)
krlmlr added a commit to duckdb/duckdb-r that referenced this pull request May 19, 2025
Extract expressions from nested conjunction AND for index scan (duckdb/duckdb#17297)
krlmlr added a commit to duckdb/duckdb-r that referenced this pull request May 19, 2025
Extract expressions from nested conjunction AND for index scan (duckdb/duckdb#17297)
Mytherin added a commit that referenced this pull request Jul 2, 2025
I was looking into
duckdblabs/duckdb-internal#5049 and tried
converting some of our `MARK` joins to `SEMI` joins. This didn't fix the
issue I was looking at (and regressed the IMDB benchmark, so I reverted
it), but it uncovered a bug in the dynamic index scan (which I
accidentally introduced in #17297).
This PR cleans up the recursion through the nested `AND` filters and
simplifies the logic so it's a lot less error-prone.

I have tried, but can't seem to reproduce it without changing the `MARK`
to `SEMI`. However, I still think the changes here are important as they
fix a bug with complex filters that can trigger an index scan.
@lnkuiper lnkuiper deleted the internal_-4742 branch July 8, 2025 08:25
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.

3 participants