Skip to content

Conversation

Tmonster
Copy link
Contributor

@Tmonster Tmonster commented Nov 1, 2024

fixes https://github.com/duckdblabs/duckdb-internal/issues/3180

And this is a followup to #13617

If the table being filtered is large enough, the order of the expressions will get moved around due to adaptive filtering. To prevent this, expression reordering now places severe penalties on expressions that can throw, effectively forcing them to be executed last. Then during adaptive filters, we set the likelihood of swapping filters that can throw to 0. This allows other filters to be swapped, but not filters. that can throw.

@duckdb-draftbot duckdb-draftbot marked this pull request as draft November 1, 2024 15:40
@Tmonster Tmonster marked this pull request as ready for review November 1, 2024 15:46
@Tmonster Tmonster marked this pull request as draft November 4, 2024 10:14
@Tmonster Tmonster marked this pull request as ready for review November 4, 2024 12:07
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the types on within the parquet file because otherwise the test would fail. I think the test is more to test union by name, and not to test the types and conversions, so I thought changing the types so the query works in all cases would be best

@Mytherin Mytherin changed the base branch from feature to main November 6, 2024 08:09
@Mytherin Mytherin merged commit ca8d605 into duckdb:main Nov 6, 2024
42 checks passed
@Mytherin
Copy link
Collaborator

Mytherin commented Nov 6, 2024

Thanks!

github-actions bot pushed a commit to duckdb/duckdb-r that referenced this pull request Dec 21, 2024
adaptive filters should not reorder filters that can throw (duckdb/duckdb#14672)
github-actions bot added a commit to duckdb/duckdb-r that referenced this pull request Dec 21, 2024
adaptive filters should not reorder filters that can throw (duckdb/duckdb#14672)

Co-authored-by: krlmlr <krlmlr@users.noreply.github.com>
Mytherin added a commit that referenced this pull request May 8, 2025
This pr tries to fix #16552 with just one simple idea: JoinCondition may
be faster, so it should be executed first instead of arbitrary
expressions.

And I have some doubts when checking this issue:
Does the order of filter expressions in sql have to be respected if any
expression ``CanThrow() == true``?

If not, then ``ExpressionHeuristics`` shouldn't skip optimising filter
expression sequence as modified in #14672

If indeed it needs to do so, then
``LogicalComparisonJoin::ExtractJoinConditions`` shouldn't split
expressions by ``LogicalFilter::SplitPredicates(expressions)`` because
this method doesn't keep original expressions sequence.
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.

2 participants