askalt commented on PR #20337:
URL: https://github.com/apache/datafusion/pull/20337#issuecomment-4038407773

   Hi! There is a patch https://github.com/apache/datafusion/pull/20009 that 
adds a more expressive API by splitting responsibilities into:
   
   1) reading expressions
   2) writing expressions
   
   This approach not only helps check for specific types of expressions in the 
plan but also enables replacing them, which extends the number of contexts 
where the API can be used. It looks a bit confusing to have all these methods 
together (`apply_expressions`, `physical_expressions` and 
`with_physical_expressions`), so with this, we can implement 
`apply_expressions` as a simple helper, like:
   
   ```rust
   pub fn visit_expressions(
       plan: &dyn ExecutionPlan,
       f: &mut dyn FnMut(&dyn PhysicalExpr) -> Result<TreeNodeRecursion>,
   ) -> Result<TreeNodeRecursion> {
       let mut tnr = TreeNodeRecursion::Continue;
       for expr in plan.physical_expressions() {
           tnr = tnr.visit_sibling(|| f(expr.as_ref()))?;
       }
       Ok(tnr)
   }
   ```


-- 
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]

Reply via email to