diff --git a/.github/workflows/benchmarks/pr_benchmarks.yml b/.github/workflows/benchmarks/pr_benchmarks.yml new file mode 100644 index 0000000000000..545e2a7cd0701 --- /dev/null +++ b/.github/workflows/benchmarks/pr_benchmarks.yml @@ -0,0 +1,35 @@ +name: Run and Cache Benchmarks + +on: + pull_request: + types: [labeled, opened, reopened, synchronize] + +jobs: + benchmark: + name: Run Benchmarks + runs-on: ubuntu-latest + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: echo "$GITHUB_CONTEXT" + + - name: Setup data and benchmark PR changes + uses: actions/checkout@v4 + run: | + cd benchmarks + ./bench.sh data tpch10 + ./bench.sh data clickbench_1 + ./bench.sh run tpch10 + ./bench.sh run clickbench_1 + + - name: Benchmark baseline and compare + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.base.sha }} + run: | + cd benchmarks + ./bench.sh run tpch10 + ./bench.sh run clickbench_1 + pip3 install rich + ./bench.sh compare ${{ github.event.pull_request.base.ref }}" ${{ github.ref }}" \ No newline at end of file diff --git a/benchmarks/bench.sh b/benchmarks/bench.sh index 2ecd42920e096..a8242572fa64c 100755 --- a/benchmarks/bench.sh +++ b/benchmarks/bench.sh @@ -166,7 +166,7 @@ main() { esac ;; run) - # Parse positional paraleters + # Parse positional parameters BENCHMARK=${ARG2:-"${BENCHMARK}"} BRANCH_NAME=$(cd ${DATAFUSION_DIR} && git rev-parse --abbrev-ref HEAD) BRANCH_NAME=${BRANCH_NAME//\//_} # mind blowing syntax to replace / with _ @@ -177,7 +177,7 @@ main() { echo "COMMAND: ${COMMAND}" echo "BENCHMARK: ${BENCHMARK}" echo "DATAFUSION_DIR: ${DATAFUSION_DIR}" - echo "BRACH_NAME: ${BRANCH_NAME}" + echo "BRANCH_NAME: ${BRANCH_NAME}" echo "DATA_DIR: ${DATA_DIR}" echo "RESULTS_DIR: ${RESULTS_DIR}" echo "CARGO_COMMAND: ${CARGO_COMMAND}" diff --git a/datafusion/physical-plan/src/sorts/sort.rs b/datafusion/physical-plan/src/sorts/sort.rs index db352bb2c86f3..63c39624b8c03 100644 --- a/datafusion/physical-plan/src/sorts/sort.rs +++ b/datafusion/physical-plan/src/sorts/sort.rs @@ -956,6 +956,9 @@ impl ExecutionPlan for SortExec { let batch = batch?; topk.insert_batch(batch)?; } + // Test whether benchmarks catch this + // TODO: remove before merge! + tokio::time::sleep(std::time::Duration::from_secs(3)).await; topk.emit() }) .try_flatten(),