mingmwang commented on PR #5630:
URL:
https://github.com/apache/arrow-datafusion/pull/5630#issuecomment-1486169300
@yahoNanJing
There are some other improvement we can do:
In the `map_children()` method of `LogicalPlan`, we can avoid construct the
plan again and again if the new children has no changes compared to the old
inputs.
```rust
fn map_children<F>(self, transform: F) -> Result<Self>
where
F: FnMut(Self) -> Result<Self>,
{
let children =
self.inputs().into_iter().cloned().collect::<Vec<_>>();
if !children.is_empty() {
let new_children: Result<Vec<_>> =
children.into_iter().map(transform).collect();
self.with_new_inputs(new_children?.as_slice())
} else {
Ok(self)
}
}
```
We have the `with_new_children_if_necessary` utils for `Arc<dyn
ExecutionPlan>` and `Arc<dyn PhysicalExpr>`
--
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]