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

Minor: make SubqueryAlias::try_new take Arc<LogicalPlan> #8542

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion datafusion/expr/src/logical_plan/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ pub fn subquery_alias(
plan: LogicalPlan,
alias: impl Into<OwnedTableReference>,
) -> Result<LogicalPlan> {
SubqueryAlias::try_new(plan, alias).map(LogicalPlan::SubqueryAlias)
SubqueryAlias::try_new(Arc::new(plan), alias).map(LogicalPlan::SubqueryAlias)
}

/// Create a LogicalPlanBuilder representing a scan of a table with the provided name and schema.
Expand Down
6 changes: 3 additions & 3 deletions datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ impl LogicalPlan {
}))
}
LogicalPlan::SubqueryAlias(SubqueryAlias { alias, .. }) => {
SubqueryAlias::try_new(inputs[0].clone(), alias.clone())
SubqueryAlias::try_new(Arc::new(inputs[0].clone()), alias.clone())
.map(LogicalPlan::SubqueryAlias)
}
LogicalPlan::Limit(Limit { skip, fetch, .. }) => {
Expand Down Expand Up @@ -1855,7 +1855,7 @@ pub struct SubqueryAlias {

impl SubqueryAlias {
pub fn try_new(
plan: LogicalPlan,
plan: Arc<LogicalPlan>,
alias: impl Into<OwnedTableReference>,
) -> Result<Self> {
let alias = alias.into();
Expand All @@ -1868,7 +1868,7 @@ impl SubqueryAlias {
.with_functional_dependencies(func_dependencies)?,
);
Ok(SubqueryAlias {
input: Arc::new(plan),
input: plan,
alias,
schema,
})
Expand Down
2 changes: 1 addition & 1 deletion datafusion/proto/src/logical_plan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ impl AsLogicalPlan for LogicalPlanNode {
Some(a) => match a {
protobuf::projection_node::OptionalAlias::Alias(alias) => {
Ok(LogicalPlan::SubqueryAlias(SubqueryAlias::try_new(
new_proj,
Arc::new(new_proj),
alias.clone(),
)?))
}
Expand Down