alamb commented on code in PR #12040:
URL: https://github.com/apache/datafusion/pull/12040#discussion_r1723514405
##########
datafusion/expr/src/logical_plan/builder.rs:
##########
@@ -145,7 +150,7 @@ impl LogicalPlanBuilder {
coerce_plan_expr_for_schema(&recursive_term, self.plan.schema())?;
Ok(Self::from(LogicalPlan::RecursiveQuery(RecursiveQuery {
name,
- static_term: Arc::new(self.plan.clone()),
+ static_term: Arc::clone(&self.plan),
Review Comment:
> Another example in line 470.
I think since this is an associated function it could also be done
indpendently to the change of the internal implementation of
`LogicalaPlanBuilder`
##########
datafusion/expr/src/logical_plan/builder.rs:
##########
@@ -145,7 +150,7 @@ impl LogicalPlanBuilder {
coerce_plan_expr_for_schema(&recursive_term, self.plan.schema())?;
Ok(Self::from(LogicalPlan::RecursiveQuery(RecursiveQuery {
name,
- static_term: Arc::new(self.plan.clone()),
+ static_term: Arc::clone(&self.plan),
Review Comment:
FWIW I think we can avoid the clone by changing the signature from
```rust
pub fn to_recursive_query(
&self,
```
to
```rust
pub fn to_recursive_query(
self,
```
(the builder should be consumed)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]