You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2023/12/15 00:22:31 UTC
(arrow-datafusion) branch main updated: Minor: make SubqueryAlias::try_new take Arc (#8542)
This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new b457f2b706 Minor: make SubqueryAlias::try_new take Arc<LogicalPlan> (#8542)
b457f2b706 is described below
commit b457f2b70682f0d574b841ec5e38a3d6709dd2a0
Author: Bo Lin <bo...@dreamsphere.org>
AuthorDate: Thu Dec 14 19:22:25 2023 -0500
Minor: make SubqueryAlias::try_new take Arc<LogicalPlan> (#8542)
Currently, all `#[non_exhaustive]` logical plan structs with a `try_new`
constructor take `Arc<LogicalPlan>` as parameter, except for
`SubqueryAlias`, which takes a `LogicalPlan`. This changes
`SubqueryAlias::try_new` to align with the other plan types, to improve API
ergonomics.
---
datafusion/expr/src/logical_plan/builder.rs | 2 +-
datafusion/expr/src/logical_plan/plan.rs | 6 +++---
datafusion/proto/src/logical_plan/mod.rs | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/datafusion/expr/src/logical_plan/builder.rs b/datafusion/expr/src/logical_plan/builder.rs
index be2c45b901..88310dab82 100644
--- a/datafusion/expr/src/logical_plan/builder.rs
+++ b/datafusion/expr/src/logical_plan/builder.rs
@@ -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.
diff --git a/datafusion/expr/src/logical_plan/plan.rs b/datafusion/expr/src/logical_plan/plan.rs
index d74015bf09..1f3711407a 100644
--- a/datafusion/expr/src/logical_plan/plan.rs
+++ b/datafusion/expr/src/logical_plan/plan.rs
@@ -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, .. }) => {
@@ -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();
@@ -1868,7 +1868,7 @@ impl SubqueryAlias {
.with_functional_dependencies(func_dependencies)?,
);
Ok(SubqueryAlias {
- input: Arc::new(plan),
+ input: plan,
alias,
schema,
})
diff --git a/datafusion/proto/src/logical_plan/mod.rs b/datafusion/proto/src/logical_plan/mod.rs
index 50bca0295d..948228d87d 100644
--- a/datafusion/proto/src/logical_plan/mod.rs
+++ b/datafusion/proto/src/logical_plan/mod.rs
@@ -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(),
)?))
}