comphead commented on PR #9050:
URL:
https://github.com/apache/arrow-datafusion/pull/9050#issuecomment-1915675555
> We basically drain the vector so there shouldn't be any leftover
collection if I am not misunderstanding your concern (we make N calls to
swap_remove when dealing with an operator with N children).
>
> I would also prefer a neater way to drain the vector instead of making
swap_remove calls, let me know if you have any suggestions.
what comes to my mind if we have a `let x = vec![0, 1, 2, 3]`
and call `s.swap_remove(0)` the remaining collection can be either `vec![3,
1, 2]` or `vec![3, 2, 1]`. So I'm wondering if it can be an issue, having
potentially random element on calling subsequent `s.swap_remove(0)` ? 🤔
Speaking on neater way, nothing comes to my head tbh, perhaps we can play
with mem::take or mem::replace, it wont drain though but we eliminate a clone
here. Will require some stub on LogicalPlan, so not sure if its worth
```
Projection::try_new(expr, Arc::new(std::mem::replace(&mut
inputs[0], LogicalPlan::Empty))))
.map(LogicalPlan::Projection)
```
--
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]