viirya commented on code in PR #8672: URL: https://github.com/apache/arrow-datafusion/pull/8672#discussion_r1437957200
########## datafusion/common/src/tree_node.rs: ########## @@ -33,6 +33,9 @@ use crate::Result; /// [`LogicalPlan`]: https://docs.rs/datafusion-expr/latest/datafusion_expr/logical_plan/enum.LogicalPlan.html /// [`Expr`]: https://docs.rs/datafusion-expr/latest/datafusion_expr/expr/enum.Expr.html pub trait TreeNode: Sized { + /// Returns all children of the TreeNode + fn children_nodes(&self) -> Vec<Self>; Review Comment: First try with `Vec<&Self>`: https://github.com/apache/arrow-datafusion/compare/main...viirya:arrow-datafusion:refactor_treenode?expand=1. But one trouble is the `TreeNode` implementation for `Arc<T>`: ```rust impl<T: DynTreeNode + ?Sized> TreeNode for Arc<T> { fn children_nodes(&self) -> Vec<&Arc<T>> { // DynTreeNode.arc_children returns Vec<Arc<Self>> and this function cannot return reference of temporary object. The implementations of `DynTreeNode.arc_children` have same issue. It cannot be changed to return Vec<&Arc<Self>> too unimplemented!("Call arc_children instead") } ``` -- 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]
