Skip to content

Conversation

@jonahgao
Copy link
Member

Which issue does this PR close?

N/A.

Rationale for this change

When planning Into, we don't need to keep a copy of the whole SetExpr, we just need to take away the necessary SelectInto.

What changes are included in this PR?

Are these changes tested?

Yes. By existing tests.

Are there any user-facing changes?

No

@github-actions github-actions bot added the sql SQL Planner label Apr 20, 2024
if let Some(with) = query.with {
self.plan_with_clause(with, planner_context)?;
}
let plan = self.set_expr_to_plan(*(set_expr.clone()), planner_context)?;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removed clone is here.

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks @jonahgao

_ => None,
};

let plan = self.set_expr_to_plan(*set_expr, planner_context)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've checked and the select.into field isn't used in this function, so should be good.

Though, I wonder if it might be a concern that we take the into before passing into this function, in case for some future use case it might also need the into? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can just clone the select.into if needed in the future. Currently, I think INTO is more like an independent planning unit, it is only connected with the input plan through data.

Copy link
Contributor

@Jefffrey Jefffrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Jefffrey Jefffrey merged commit ec2592b into apache:main Apr 21, 2024
@jonahgao jonahgao deleted the avoid_clone branch April 21, 2024 09:35
ccciudatu pushed a commit to hstack/datafusion that referenced this pull request Apr 26, 2024
…pache#10152)

* minor: avoid cloning the `SetExpr` during planning of `SelectInto`

* retry ci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sql SQL Planner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants