alamb commented on code in PR #7924:
URL: https://github.com/apache/arrow-datafusion/pull/7924#discussion_r1372179037
##########
datafusion/core/src/physical_optimizer/enforce_sorting.rs:
##########
@@ -496,9 +496,10 @@ fn ensure_sorting(
{
// This SortPreservingMergeExec is unnecessary, input already has a
// single partition.
+ sort_onwards.truncate(1);
return Ok(Transformed::Yes(PlanWithCorrespondingSort {
- plan: children[0].clone(),
- sort_onwards: vec![sort_onwards[0].clone()],
+ plan: children.swap_remove(0),
Review Comment:
https://doc.rust-lang.org/std/vec/struct.Vec.html#method.swap_remove says
"does not preserve the order" -- is the idea here that there is only one
element in child and this avoids a clone?
I think we have used the `pop` method to do something similar elsewhere in
the code (like `children.pop().unwrap()`)
Not that this needs to change, just an observation
--
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]