Skip to content

Fix query optimization for semijoins#4287

Open
joshua-spacetime wants to merge 1 commit intomasterfrom
joshua/query-bugfix
Open

Fix query optimization for semijoins#4287
joshua-spacetime wants to merge 1 commit intomasterfrom
joshua/query-bugfix

Conversation

@joshua-spacetime
Copy link
Collaborator

Description of Changes

Fixes a planner bug where certain join queries could fail with:

Could not compute positional arguments during query planning

The reason was that in the process of rewriting the query with semijoins, the fallback branch of the optimization rule didn't track the dependencies of the join correctly. In particular it didn't mark the LHS table in the join condition as a dependency when recursing into the LHS of the join tree. This led to the table being projected out or dropped in the LHS subtree while still being referenced by the root of the subtree.

This only happened for bridge tables (tables used to link or bridge other tables in the join, but whose columns are not referenced in the final output). If the table was referenced in the output, it would be included in the list of dependencies from the start and so this bug would not manifest.

API and ABI breaking changes

None

Expected complexity level and risk

1

Testing

Added a sql execution test

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.

1 participant