forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
35711: sql: permit subqueries within RHS of applyjoin r=jordanlewis a=jordanlewis Previously, the code assumed that subqueries would have already been promoted to top-level subqueries and run exactly once by the re-optimization phase of apply join. However, that promotion happens in execbuild, not in the optimizer, and therefore won't have already happened by the time that we go to execbuild the re-optimized RHS in apply join. For now, the solution is to re-run the subqueries in the RHS every time the RHS is run. This is suboptimal because subqueries need only be run once per query regardless of their position within the apply join tree. However, setting this up currently is difficult at the moment and would have required a more invasive change. When WITH support is available, the optimizer will promote subqueries into WITH clauses up front, at which point we will be able to safely remove the requirement that apply join rerun subqueries on the RHS. Closes cockroachdb#35594. Release note: None Co-authored-by: Jordan Lewis <[email protected]>
- Loading branch information
Showing
4 changed files
with
67 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters