alamb commented on code in PR #13177:
URL: https://github.com/apache/datafusion/pull/13177#discussion_r1833126198


##########
datafusion/common/src/tree_node.rs:
##########
@@ -937,6 +943,28 @@ impl<T> TransformedResult<T> for Result<Transformed<T>> {
     }
 }
 
+/// A node trait which makes all tree traversal iterative and not recursive.
+pub trait RecursiveNode: Sized {
+    /// Read-only access to children
+    fn children(&self) -> Vec<&Self>;
+
+    /// Detaches children from the parent node (if possible).
+    /// Unlike [`ConcreteTreeNode`] it doesn't possible that the value will 
actually be removed from the parent
+    fn take_children(self) -> (Self, Vec<Self>);

Review Comment:
   Could these methods be moved into `TreeNode` itself? It feels like it just 
makes things additionally complicated to try and implement a separate set of 
APIs that are related but not quite the same
   
   



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