Skip to content

vibe-bench: dynamically choose between CollectLeft and Partitioned join - #4

Draft
Samyak2 wants to merge 6 commits into
mainfrom
dynamic-join-switching-stage-boundary
Draft

Samyak2 wants to merge 6 commits into
mainfrom
dynamic-join-switching-stage-boundary

Conversation

@Samyak2

@Samyak2 Samyak2 commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

An experiment to prove the value of dynamically choosing CollectLeft/Partitioned join instead of plan-time (the idea is from apache#20847).

Warning: pretty much fully vibe-coded by Astra. I have not looked at the code.

Built on top of apache#25798 (to prove the value of such an API inside datafusion).

Results

On my laptop (MacBook Pro, M4 Pro, 14 cores). The time of TPC-DS SF1 went from 6748.5 ms to 6511.0 ms (~3% improvement).

Not a big improvement overall, but some queries are very interesting.

Query Baseline Dynamic switch Speedup Why
Q67 174.09 ms 77.64 ms 2.24× Planner chose CollectLeft. At runtime, we chose Partitioned.
Q64 261.02 ms 190.71 ms 1.37× 4 joins go from CollectLeft → Partitioned.
Q4 294.86 ms 236.92 ms 1.24× 11 joins go from CollectLeft → Partitioned.
Q11 189.54 ms 137.51 ms 1.38× 7 joins go from CollectLeft → Partitioned.
Q75 108.29 ms 85.94 ms 1.26× Final yearly-sales aggregate join: Partitioned → CollectLeft. Only 885 rows.
Q58 78.89 ms 59.62 ms 1.32× Catalog/store revenue-aggregate join: Partitioned → CollectLeft. Only 2.61k rows.

edmondop and others added 6 commits September 26, 2026 18:03
- Planner estimates can partition joins whose actual builds are small, or
  collect builds that benefit from parallel hashing.
  - Start with CollectLeft and choose the distribution from buffered build
    bytes using StageBoundary, retaining the planner's build-side choice.
  - Use the SF1-tuned 2.5 MiB total-build threshold.
- Start both input subtrees before awaiting the build so independent stages
  retain execution overlap. Preserve the original join's dynamic filters.
- Enable the experiment in the normal TPC-DS command so the benchmark runner
  exercises it without custom flags.
  - Provide a default-planner opt-out and a byte-threshold override through
    both CLI options and environment variables.
  - Keep the normal five-iteration timing and result reporting paths.
- Local SF1 with 14 partitions reduced the sum of per-query minima from
  6748.5 ms to 6511.0 ms (3.5%).
  - Average of two reversed-order passes, five iterations each, none discarded.
  - Measured with release-nonlto on an M4 Pro; larger scales remain untested.
- Keep this draft confined to benchmarks: buffer complete builds without
  spilling and leave null-aware joins in CollectLeft mode.

Co-authored-by: OpenAI Codex <[email protected]>
@Samyak2 Samyak2 changed the title perf(benchmarks): exercise adaptive StageBoundary joins in TPC-DS vibe-bench: dynamically choose between CollectLeft and Partitioned join Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants