8000 Fix #16552: adjust join condition sequence by flashmouse · Pull Request #16943 · duckdb/duckdb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix #16552: adjust join condition sequence #16943

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
May 8, 2025

Conversation

flashmouse
Copy link
Contributor

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.

@Tmonster
Copy link
Contributor
Tmonster commented Apr 2, 2025

Does the order of filter expressions in sql have to be respected if any expression CanThrow() == true

It should yes. Sometime there are cases where a filter filters out values that would eventually cause an exception. I.e

select a, b from tbl1 where a like '{int-like-str}` and a::INT > 5;

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.

this is a good point, something that should be investigated soon

@Mytherin Mytherin merged commit e0e4cc2 into duckdb:main May 8, 2025
46 checks passed
@Mytherin
Copy link
Collaborator
Mytherin commented May 8, 2025

Thanks!

krlmlr added a commit to duckdb/duckdb-r that referenced this pull request May 18, 2025
krlmlr added a commit to duckdb/duckdb-r that referenced this pull request May 18, 2025
krlmlr added a commit to duckdb/duckdb-r that referenced this pull request May 19, 2025
krlmlr added a commit to duckdb/duckdb-r that referenced this pull request May 19, 2025
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.

Performance Regression in LEFT JOIN with Timestamp Calculations (v1.1.1 → v1.2.0)
3 participants
0