xudong963 commented on code in PR #14207:
URL: https://github.com/apache/datafusion/pull/14207#discussion_r1959895206
##########
datafusion/physical-optimizer/src/enforce_distribution.rs:
##########
@@ -1362,6 +1383,21 @@ pub fn ensure_distribution(
plan.with_new_children(children_plans)?
};
+ // If `fetch` was not consumed, it means that there was
`SortPreservingMergeExec` with fetch before
+ // It was removed by `remove_dist_changing_operators`
+ // and we need to add it back.
+ if fetch.is_some() {
+ plan = Arc::new(
+ SortPreservingMergeExec::new(
+ plan.output_ordering()
+ .unwrap_or(&LexOrdering::default())
+ .clone(),
+ plan,
+ )
+ .with_fetch(fetch.take()),
+ )
Review Comment:
And then the `SortPreservingMerge` may be optimized/removed.
--
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]