LorrensP-2158466 opened a new issue, #10808:
URL: https://github.com/apache/datafusion/issues/10808

   ### Is your feature request related to a problem or challenge?
   
   Currently, the only way to get the inputs of a LogicalPlan is to call 
`inputs()`, which returns a `Vec<&LogicalPlan>`. But I have noticed that there 
can be unnecessary calls to `into_iter()` or `iter()` on this vector.
   Furthermore, the function returns a lot of Vectors of size 1, which can 
create unnecessary allocations.
   This also applies to UserDefinedLogicalNode(Core), since I don't think the 
compiler can see through the use of `inputs()` and convert the Vec to an 
iterator.
   
   ### Describe the solution you'd like
   
   To change the API to return an Iterator instead of a vector requires a lot 
of rewriting, so I think it's maybe nicer to create a new function that returns 
an iterator over the inputs like this:
   ```rust 
   fn inputs_iter(&self) -> impl Iterator<Item = &LogicalPlan> {}
   ```.
   We also have to extend the API of UserDefinedLogicalNode(Core) to have the 
same function so extension node's have this ability as well.
   
   So instead of all the `vec![ input ]` calls, we can use `std::iter::once`, 
empty vec's can be empty iterators and in the case of an extension node we can 
just call `node.inputs_iter()`. 
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   This issue is purely for changing the API, so I'm willing to do it if this 
is accepted. To use this function in the source code is a bit more work, so I 
think it will be better to open another issue for changing the calls to 
`inputs()` into `inputs_iter()`.
   
   I may be entirely wrong since I'm fairly new to DataFusion, so any feedback 
is greatly appreciated.


-- 
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: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to