Skip to content

Do not push filters into SubqueryAliases that wrap RecursiveCTEs#3426

Merged
angelamayxie merged 11 commits intomainfrom
angela/notexists_lateralsubquery
Feb 12, 2026
Merged

Do not push filters into SubqueryAliases that wrap RecursiveCTEs#3426
angelamayxie merged 11 commits intomainfrom
angela/notexists_lateralsubquery

Conversation

@angelamayxie
Copy link
Copy Markdown
Contributor

@angelamayxie angelamayxie commented Feb 12, 2026

fixes dolthub/dolt#10472

All RecursiveCTEs are wrapped by a SubqueryAlias node. We currently don't push filters through a RecursiveCTE so pushing the filter below the SubqueryAlias just causes it to be awkwardly sandwiched in between and might make some queries less optimal if the filter contains outerscope columns since the SQA gets marked as uncacheable. We probably can push filters through a RecursiveCTE in some cases, but we should spend more time thinking about what that means (see dolthub/dolt#10490).

Also contains some refactors that I noticed along the way.

skipped tests will be fixed in #3427

@angelamayxie angelamayxie changed the title Do no push filters into SubqueryAliases that wrap RecursiveCTE nodes Do no push filters into SubqueryAliases created from CTEs Feb 12, 2026
@angelamayxie angelamayxie changed the title Do no push filters into SubqueryAliases created from CTEs Filter and SubqueryAlias refactors Feb 12, 2026
@angelamayxie angelamayxie marked this pull request as ready for review February 12, 2026 18:42
@angelamayxie angelamayxie changed the title Filter and SubqueryAlias refactors [no-release-notes] Filter and SubqueryAlias refactors Feb 12, 2026
@angelamayxie angelamayxie changed the title [no-release-notes] Filter and SubqueryAlias refactors Do not push filters into SubqueryAliases that wrap RecursiveCTEs Feb 12, 2026
@angelamayxie angelamayxie merged commit d6f567d into main Feb 12, 2026
8 checks passed
@angelamayxie angelamayxie deleted the angela/notexists_lateralsubquery branch February 12, 2026 20:08
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.

panic: slice bounds out of range in mergeJoinIter.removeParentRow with recursive CTE + NOT EXISTS

2 participants