Skip to content

Commit 19591bd

Browse files
authored
perf: Drop tasks early in distributed limits (#6350)
1 parent e475323 commit 19591bd

File tree

1 file changed

+4
-1
lines changed
  • src/daft-distributed/src/pipeline_node

1 file changed

+4
-1
lines changed

src/daft-distributed/src/pipeline_node/limit.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,10 @@ impl LimitNode {
328328

329329
// Update max_concurrent_tasks based on actual output
330330
// Only update if we have remaining limit, and we did get some output
331-
if !limit_state.is_take_done() && total_num_rows > 0 && num_local_limits > 0 {
331+
if limit_state.is_take_done() {
332+
// Drop the input channel to cancel any input tasks
333+
break;
334+
} else if total_num_rows > 0 && num_local_limits > 0 {
332335
let rows_per_task = total_num_rows.div_ceil(num_local_limits);
333336
max_concurrent_tasks = limit_state.remaining_take().div_ceil(rows_per_task);
334337
}

0 commit comments

Comments
 (0)