8000 Add correlated columns to LogicalDistinct::distinct_targets when flattening dependent joins by lnkuiper · Pull Request #5286 · duckdb/duckdb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add correlated columns to LogicalDistinct::distinct_targets when flattening dependent joins #5286

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
Nov 11, 2022

Conversation

lnkuiper
Copy link
Contributor

Since the pipeline rework in #4970 we can now execute UNION pipelines in parallel. This uncovered an issue with our correlated subquery flattening, which very rarely showed up in our CI. It seemed like a race condition, but it was not!

When creating the physical plan for a LogicalDistinct, we created a first aggregate for every non-group column. This usually worked, but this aggregate is order-dependent. If the LogicalDistinct is the sink of one or more union pipelines, the input order is no longer guaranteed, since these are now executed in parallel.

The solution is to add the correlated column to the distinct_targets, so that it is a group, rather than a first aggregate.

@Mytherin Mytherin merged commit 0dcead7 into duckdb:master Nov 11, 2022
@Mytherin
Copy link
Collaborator

Thanks!

@lnkuiper lnkuiper deleted the correlated_distinct branch November 21, 2022 08:07
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
0