Skip to content

Commit a2dd7ee

Browse files
authored
Return input task count in NetworkBoundary (#204)
1 parent 3d3609c commit a2dd7ee

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

src/distributed_planner/network_boundary.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ pub trait NetworkBoundary: ExecutionPlan {
3535
input_tasks: usize,
3636
) -> datafusion::common::Result<Arc<dyn NetworkBoundary>>;
3737

38+
/// Returns the input tasks assigned to this [NetworkBoundary].
39+
fn input_task_count(&self) -> usize;
40+
3841
/// Called when a [Stage] is correctly formed. The [NetworkBoundary] can use this
3942
/// information to perform any internal transformations necessary for distributed execution.
4043
///

src/execution_plans/network_coalesce.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,13 @@ impl NetworkBoundary for NetworkCoalesceExec {
176176
}
177177
}))
178178
}
179+
180+
fn input_task_count(&self) -> usize {
181+
match self {
182+
Self::Pending(v) => v.input_tasks,
183+
Self::Ready(v) => v.input_stage.tasks.len(),
184+
}
185+
}
179186
}
180187

181188
impl DisplayAs for NetworkCoalesceExec {

src/execution_plans/network_shuffle.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,13 @@ impl NetworkBoundary for NetworkShuffleExec {
203203
}))
204204
}
205205

206+
fn input_task_count(&self) -> usize {
207+
match self {
208+
Self::Pending(v) => v.input_tasks,
209+
Self::Ready(v) => v.input_stage.tasks.len(),
210+
}
211+
}
212+
206213
fn with_input_stage(
207214
&self,
208215
input_stage: Stage,

0 commit comments

Comments
 (0)