askalt commented on issue #20899:
URL: https://github.com/apache/datafusion/issues/20899#issuecomment-4056174816
Implementing two methods with similar semantic seems hard to maintain. What
if we inject recompute properties behavior to the closure return type with a
lightweight structure?
```rust
pub enum RecomputePropertiesBehavior {
Preserve,
Recompute,
}
pub struct MappedExpr {
pub properties_behavior: RecomputePropertiesBehavior,
pub expr: Arc<dyn PhysicalExpr>,
}
pub trait ExecutionPlan {
...
fn map_expressions(
self: Arc<Self>,
f: &dyn FnMut(Arc<dyn PhysicalExpr>) ->
Result<Transformed<MappedExpr>>,
) -> Result<Transformed<Arc<dyn ExecutionPlan>>>;
}
```
And then if at least one returned expression has
`RecomputePropertiesBehavior::Recompute` -- the implementation will recompute
them and leave as is otherwise.
--
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]