Skip to content

bench: add ASOF join benchmarks - #23833

Draft
Xuanwo wants to merge 7 commits into
apache:mainfrom
Xuanwo:xuanwo/asof-benchmarks
Draft

bench: add ASOF join benchmarks#23833
Xuanwo wants to merge 7 commits into
apache:mainfrom
Xuanwo:xuanwo/asof-benchmarks

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Jul 23, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

Rationale for this change

This is the benchmark layer of the ASOF JOIN stack. It keeps performance
workloads separate from the execution, logical, and SQL implementation reviews.

GitHub shows the cumulative stack because fork branches cannot be selected as
upstream PR bases. The isolated diff for this layer is:
Xuanwo/datafusion@xuanwo/asof-sql...xuanwo/asof-benchmarks

What changes are included in this PR?

  • Add a dfbench asof command with six end-to-end workloads: ordered and
    grouped predecessor matching, wide payloads, descending successor matching,
    broadcast-side size asymmetry, and skewed equality keys.
  • Stream output batches during timing instead of retaining result buffers.
  • Assert that each workload plans to AsOfJoinExec.
  • Add a physical Criterion benchmark for Int64, wide UTF-8, and dictionary
    payloads.
  • Exercise both one and four left partitions while keeping the right input
    single-partitioned, covering broadcast build reuse and left-side parallelism.

Are these changes tested?

Yes:

  • cargo fmt --all
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo run -p datafusion-benchmarks --bin dfbench -- asof --iterations 1 --partitions 4
  • cargo bench -p datafusion-physical-plan --bench asof_join --features test_utils -- --test

The refreshed head completed all six end-to-end workloads with the expected
1,000,000, 1,000,000, 250,000, 500,000, 100,000, and 1,000,000 row counts. The
Criterion smoke run completed all six combinations of payload type and left
partition count. These debug/smoke runs validate the harness and are not
presented as performance claims.

Are there any user-facing changes?

This adds ASOF workloads to the repository benchmark tooling. It does not change
query semantics or runtime behavior.

This PR should be reviewed and merged after #23830. It does not depend on the
optional floating-point follow-up #24375.

@github-actions github-actions Bot added documentation Improvements or additions to documentation sql SQL Planner logical-expr Logical plan and expressions optimizer Optimizer rules core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) substrait Changes to the substrait crate proto Related to proto crate physical-plan Changes to the physical-plan crate labels Jul 23, 2026
@codecov-commenter

codecov-commenter commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 61.22159% with 273 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.51%. Comparing base (c4910e0) to head (1eb4760).
⚠️ Report is 20 commits behind head on main.

Files with missing lines Patch % Lines
datafusion/sql/src/unparser/plan.rs 51.16% 77 Missing and 7 partials ⚠️
datafusion/expr/src/logical_plan/plan.rs 59.48% 63 Missing and 16 partials ⚠️
benchmarks/src/asof.rs 0.00% 62 Missing ⚠️
datafusion/sql/src/relation/join.rs 83.33% 7 Missing and 8 partials ⚠️
datafusion/expr/src/logical_plan/display.rs 0.00% 10 Missing ⚠️
datafusion/expr/src/logical_plan/builder.rs 83.92% 1 Missing and 8 partials ⚠️
datafusion/core/src/physical_planner.rs 85.36% 4 Missing and 2 partials ⚠️
datafusion/expr/src/logical_plan/tree_node.rs 93.02% 0 Missing and 3 partials ⚠️
datafusion/optimizer/src/analyzer/type_coercion.rs 92.85% 1 Missing and 1 partial ⚠️
datafusion/optimizer/src/optimizer.rs 50.00% 0 Missing and 2 partials ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #23833      +/-   ##
==========================================
+ Coverage   81.47%   81.51%   +0.03%     
==========================================
  Files        1122     1124       +2     
  Lines      403629   406793    +3164     
  Branches   403629   406793    +3164     
==========================================
+ Hits       328866   331591    +2725     
- Misses      55510    55789     +279     
- Partials    19253    19413     +160     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

Thank you for opening this pull request!

Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch).

Details
     Cloning apache/main
    Building datafusion v55.0.0 (current)
       Built [  62.343s] (current)
     Parsing datafusion v55.0.0 (current)
      Parsed [   0.035s] (current)
    Building datafusion v55.0.0 (baseline)
       Built [  62.047s] (baseline)
     Parsing datafusion v55.0.0 (baseline)
      Parsed [   0.036s] (baseline)
    Checking datafusion v55.0.0 -> v55.0.0 (no change; assume patch)
     Checked [   0.584s] 223 checks: 223 pass, 31 skip
     Summary no semver update required
    Finished [ 127.333s] datafusion
    Building datafusion-expr v55.0.0 (current)
       Built [  30.906s] (current)
     Parsing datafusion-expr v55.0.0 (current)
      Parsed [   0.077s] (current)
    Building datafusion-expr v55.0.0 (baseline)
       Built [  30.407s] (baseline)
     Parsing datafusion-expr v55.0.0 (baseline)
      Parsed [   0.077s] (baseline)
    Checking datafusion-expr v55.0.0 -> v55.0.0 (no change; assume patch)
     Checked [   1.217s] 223 checks: 222 pass, 1 fail, 0 warn, 31 skip

--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.50.0/src/lints/enum_variant_added.ron

Failed in:
  variant LogicalPlan:AsOfJoin in /home/runner/work/datafusion/datafusion/datafusion/expr/src/logical_plan/plan.rs:301
  variant LogicalPlan:AsOfJoin in /home/runner/work/datafusion/datafusion/datafusion/expr/src/logical_plan/plan.rs:301

     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  63.674s] datafusion-expr
    Building datafusion-optimizer v55.0.0 (current)
       Built [  28.331s] (current)
     Parsing datafusion-optimizer v55.0.0 (current)
      Parsed [   0.032s] (current)
    Building datafusion-optimizer v55.0.0 (baseline)
       Built [  29.321s] (baseline)
     Parsing datafusion-optimizer v55.0.0 (baseline)
      Parsed [   0.033s] (baseline)
    Checking datafusion-optimizer v55.0.0 -> v55.0.0 (no change; assume patch)
     Checked [   0.172s] 223 checks: 223 pass, 31 skip
     Summary no semver update required
    Finished [  58.661s] datafusion-optimizer
    Building datafusion-physical-plan v55.0.0 (current)
       Built [  40.448s] (current)
     Parsing datafusion-physical-plan v55.0.0 (current)
      Parsed [   0.155s] (current)
    Building datafusion-physical-plan v55.0.0 (baseline)
       Built [  40.522s] (baseline)
     Parsing datafusion-physical-plan v55.0.0 (baseline)
      Parsed [   0.153s] (baseline)
    Checking datafusion-physical-plan v55.0.0 -> v55.0.0 (no change; assume patch)
     Checked [   0.741s] 223 checks: 223 pass, 31 skip
     Summary no semver update required
    Finished [  83.128s] datafusion-physical-plan
    Building datafusion-proto v55.0.0 (current)
       Built [  57.281s] (current)
     Parsing datafusion-proto v55.0.0 (current)
      Parsed [   0.017s] (current)
    Building datafusion-proto v55.0.0 (baseline)
       Built [  57.500s] (baseline)
     Parsing datafusion-proto v55.0.0 (baseline)
      Parsed [   0.018s] (baseline)
    Checking datafusion-proto v55.0.0 -> v55.0.0 (no change; assume patch)
     Checked [   0.127s] 223 checks: 223 pass, 31 skip
     Summary no semver update required
    Finished [ 116.090s] datafusion-proto
    Building datafusion-sql v55.0.0 (current)
       Built [  45.124s] (current)
     Parsing datafusion-sql v55.0.0 (current)
      Parsed [   0.032s] (current)
    Building datafusion-sql v55.0.0 (baseline)
       Built [  45.172s] (baseline)
     Parsing datafusion-sql v55.0.0 (baseline)
      Parsed [   0.034s] (baseline)
    Checking datafusion-sql v55.0.0 -> v55.0.0 (no change; assume patch)
     Checked [   0.228s] 223 checks: 223 pass, 31 skip
     Summary no semver update required
    Finished [  91.611s] datafusion-sql
    Building datafusion-sqllogictest v55.0.0 (current)
       Built [ 105.680s] (current)
     Parsing datafusion-sqllogictest v55.0.0 (current)
      Parsed [   0.021s] (current)
    Building datafusion-sqllogictest v55.0.0 (baseline)
       Built [ 105.306s] (baseline)
     Parsing datafusion-sqllogictest v55.0.0 (baseline)
      Parsed [   0.026s] (baseline)
    Checking datafusion-sqllogictest v55.0.0 -> v55.0.0 (no change; assume patch)
     Checked [   0.103s] 223 checks: 223 pass, 31 skip
     Summary no semver update required
    Finished [ 213.857s] datafusion-sqllogictest
    Building datafusion-substrait v55.0.0 (current)
       Built [ 324.791s] (current)
     Parsing datafusion-substrait v55.0.0 (current)
      Parsed [   0.017s] (current)
    Building datafusion-substrait v55.0.0 (baseline)
       Built [ 333.602s] (baseline)
     Parsing datafusion-substrait v55.0.0 (baseline)
      Parsed [   0.018s] (baseline)
    Checking datafusion-substrait v55.0.0 -> v55.0.0 (no change; assume patch)
     Checked [   0.257s] 223 checks: 223 pass, 31 skip
     Summary no semver update required
    Finished [ 660.481s] datafusion-substrait

@github-actions github-actions Bot added the auto detected api change Auto detected API change label Jul 23, 2026
@github-actions github-actions Bot added the physical-expr Changes to the physical-expr crates label Aug 14, 2026
@Xuanwo
Xuanwo force-pushed the xuanwo/asof-benchmarks branch from e826548 to 1ff6d2b Compare August 20, 2026 17:56
@Xuanwo
Xuanwo force-pushed the xuanwo/asof-benchmarks branch from 1ff6d2b to c3d099b Compare August 28, 2026 05:40
@github-actions github-actions Bot removed the physical-expr Changes to the physical-expr crates label Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto detected api change Auto detected API change core Core DataFusion crate documentation Improvements or additions to documentation logical-expr Logical plan and expressions optimizer Optimizer rules physical-plan Changes to the physical-plan crate proto Related to proto crate sql SQL Planner sqllogictest SQL Logic Tests (.slt) substrait Changes to the substrait crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants