xudong963 commented on code in PR #14207:
URL: https://github.com/apache/datafusion/pull/14207#discussion_r1971122511
##########
datafusion/physical-optimizer/src/enforce_distribution.rs:
##########
@@ -987,16 +1003,22 @@ fn add_spm_on_top(input: DistributionContext) ->
DistributionContext {
fn remove_dist_changing_operators(
mut distribution_context: DistributionContext,
) -> Result<DistributionContext> {
+ let mut fetch = None;
while is_repartition(&distribution_context.plan)
|| is_coalesce_partitions(&distribution_context.plan)
|| is_sort_preserving_merge(&distribution_context.plan)
{
+ if is_sort_preserving_merge(&distribution_context.plan) {
Review Comment:
I have a more straightforward/"violent" way to fix the bug, we don't remove
the operator if it have `fetch`. This will definitely gurantee correctness. cc
@berkaysynnada
--
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]