andygrove commented on code in PR #909:
URL: https://github.com/apache/datafusion-comet/pull/909#discussion_r1744279713
##########
native/core/src/execution/datafusion/planner.rs:
##########
@@ -1347,12 +1349,24 @@ impl PhysicalPlanner {
match datatype {
DataType::Decimal128(_, _) => {
- Ok(Arc::new(SumDecimal::new("sum", child, datatype)))
+ let func = AggregateUDF::new_from_impl(SumDecimal::new(
+ "sum",
+ Arc::clone(&child),
Review Comment:
We need to clone because we reference child again in the next statement. If
I remove the close, the code fails to compile:
```
error[E0382]: use of moved value: `child`
--> core/src/execution/datafusion/planner.rs:1357:72
|
1347 | let child =
self.create_expr(expr.child.as_ref().unwrap(), Arc::clone(&schema))?;
| ----- move occurs because `child` has type
`Arc<dyn datafusion_physical_expr::PhysicalExpr>`, which does not implement the
`Copy` trait
...
1354 | child,
| ----- value moved here
...
1357 | AggregateExprBuilder::new(Arc::new(func),
vec![child])
|
^^^^^ value used here after move
```
##########
native/core/src/execution/datafusion/planner.rs:
##########
@@ -1347,12 +1349,24 @@ impl PhysicalPlanner {
match datatype {
DataType::Decimal128(_, _) => {
- Ok(Arc::new(SumDecimal::new("sum", child, datatype)))
+ let func = AggregateUDF::new_from_impl(SumDecimal::new(
+ "sum",
+ Arc::clone(&child),
Review Comment:
We need to clone because we reference child again in the next statement. If
I remove the clone, the code fails to compile:
```
error[E0382]: use of moved value: `child`
--> core/src/execution/datafusion/planner.rs:1357:72
|
1347 | let child =
self.create_expr(expr.child.as_ref().unwrap(), Arc::clone(&schema))?;
| ----- move occurs because `child` has type
`Arc<dyn datafusion_physical_expr::PhysicalExpr>`, which does not implement the
`Copy` trait
...
1354 | child,
| ----- value moved here
...
1357 | AggregateExprBuilder::new(Arc::new(func),
vec![child])
|
^^^^^ value used here after move
```
--
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]