peter-toth commented on PR #8891:
URL: 
https://github.com/apache/arrow-datafusion/pull/8891#issuecomment-1913595677

   > One thing that raises my "why is it like that?" instinct is the 
distinction between return types of down and up functions. Is there a specific 
reason we'd have such an asymmetry?
   
   Oh yes, there is. The only enum element that would make sense in `f_up` is 
`TreeNodeRecursion::Stop` to fully stop recursion immediately (`Continue` is 
the default behaviour, and `Skip` doesn't make sense as we already 
visited/transformed childrens).
   Currently we don't support `TreeNodeRecursion::Stop` in `f_down` either. 
(Maybe I forgot to document that.) This is because to support `Stop` we would 
need `TreeNode.map_children()` to accept a closure that can return 
`TreeNodeRecursion` beisdes the transformed node, but it doesn't do that now. 
(See `apply_children` that returns `TreeNodeRecursion` and so `Stop` is 
supported there.)
   To sum up, I think we can add `TreeNodeRecursion` to `f_up` in the future so 
as to make `f_down` and `f_up` symmetric, but I would rather do that in a 
follow-up PR and I'm not sure we need that feature now.
   
   


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

Reply via email to