Skip to content

Commit 19988a8

Browse files
authored
with preserve order now receives argument (#7231)
1 parent 43f182f commit 19988a8

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

datafusion/core/src/physical_optimizer/replace_with_order_preserving_variants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ fn get_updated_plan(
178178
let child = plan.children()[0].clone();
179179
plan = Arc::new(
180180
RepartitionExec::try_new(child, plan.output_partitioning())?
181-
.with_preserve_order(),
181+
.with_preserve_order(true),
182182
) as _
183183
}
184184
// When the input of a `CoalescePartitionsExec` has an ordering, replace it

datafusion/core/src/physical_plan/repartition/mod.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,9 @@ impl ExecutionPlan for RepartitionExec {
419419
self: Arc<Self>,
420420
children: Vec<Arc<dyn ExecutionPlan>>,
421421
) -> Result<Arc<dyn ExecutionPlan>> {
422-
let mut repartition =
423-
RepartitionExec::try_new(children[0].clone(), self.partitioning.clone())?;
424-
if self.preserve_order {
425-
repartition = repartition.with_preserve_order();
426-
}
422+
let repartition =
423+
RepartitionExec::try_new(children[0].clone(), self.partitioning.clone())?
424+
.with_preserve_order(self.preserve_order);
427425
Ok(Arc::new(repartition))
428426
}
429427

@@ -625,8 +623,8 @@ impl RepartitionExec {
625623
}
626624

627625
/// Set Order preserving flag
628-
pub fn with_preserve_order(mut self) -> Self {
629-
self.preserve_order = true;
626+
pub fn with_preserve_order(mut self, preserve_order: bool) -> Self {
627+
self.preserve_order = preserve_order;
630628
self
631629
}
632630

datafusion/core/tests/fuzz_cases/sort_preserving_repartition_fuzz.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ mod sp_repartition_fuzz_tests {
140140
Arc::new(
141141
RepartitionExec::try_new(input, Partitioning::RoundRobinBatch(2))
142142
.unwrap()
143-
.with_preserve_order(),
143+
.with_preserve_order(true),
144144
)
145145
}
146146

@@ -159,7 +159,7 @@ mod sp_repartition_fuzz_tests {
159159
Arc::new(
160160
RepartitionExec::try_new(input, Partitioning::Hash(hash_expr, 2))
161161
.unwrap()
162-
.with_preserve_order(),
162+
.with_preserve_order(true),
163163
)
164164
}
165165

0 commit comments

Comments
 (0)