Skip to content

Local worker allocations#559

Open
gabotechs wants to merge 1 commit into
mainfrom
gabrielmusat/local-worker-allocations
Open

Local worker allocations#559
gabotechs wants to merge 1 commit into
mainfrom
gabrielmusat/local-worker-allocations

Conversation

@gabotechs

@gabotechs gabotechs commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Small optimization that allows the dynamic planner to collocate single-tasked stages into the same machine that is acting as coordinator.

During dynamic planning, if all stages are small, they will just use 1 task, and before this PR, there was already some logic for co-locating all stages in a single worker. The challenge:

The single worker was a random worker in the cluster.

This means that if the coordinating context also happens to be in the scope of a worker, there's a missed chance for running everything locally, almost as if it was just single-node DataFusion.

This PRs unlocks this scenario by allowing users to inject their own LocalWorkerContext into the coordinating SessionContext. That way, the coordinator itself can recognize it's also a worker, and can send to itself all these single-tasked stages, avoiding network hops and data serialization.

Benchmarks

TPCH-SF1: 1.12 faster ✔
TPCH-SF10: 1.06 faster ✔
TPCH-SF100: 1.01 faster ✔
TPC-DS: 1.08 faster ✔
ClickBench: 1.01 faster ✔

@gabotechs
gabotechs force-pushed the gabrielmusat/local-worker-allocations branch 2 times, most recently from f6799a0 to 2dbf1fb Compare July 20, 2026 09:45
@gabotechs
gabotechs marked this pull request as ready for review July 20, 2026 10:36
@gabotechs
gabotechs force-pushed the gabrielmusat/local-worker-allocations branch 2 times, most recently from af42530 to 2183672 Compare July 21, 2026 10:12
@gabotechs
gabotechs force-pushed the gabrielmusat/local-worker-allocations branch from 2183672 to 407fbeb Compare July 21, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant