Skip to content
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

Feat(optimizer): expand join constructs into SELECT * from subqueries #1560

Merged
merged 10 commits into from
May 6, 2023
Prev Previous commit
Next Next commit
Remove unnecessary copying
georgesittas committed May 5, 2023
commit a955af9d696125f668bac97ff168db5a2d3ab47f
4 changes: 3 additions & 1 deletion sqlglot/optimizer/expand_join_constructs.py
Original file line number Diff line number Diff line change
@@ -26,6 +26,8 @@ def expand_join_constructs(expression: exp.Expression) -> exp.Expression:
while isinstance(outermost_subquery.parent, exp.Subquery):
outermost_subquery = outermost_subquery.parent

outermost_subquery.this.replace(exp.select("*").from_(scope.expression.copy()))
outermost_subquery.this.replace(
exp.select("*").from_(scope.expression.copy(), copy=False)
)

return expression