Skip to content

Commit ae11ac8

Browse files
andygroveclaude
andcommitted
perf: build native library once for Spark SQL tests
- Add build-native job that builds libcomet.so once - Add skip-native-build input to setup-spark-builder action - All ~48 test jobs now download pre-built artifact instead of rebuilding Eliminates 47 redundant Rust builds. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2901f87 commit ae11ac8

2 files changed

Lines changed: 73 additions & 1 deletion

File tree

.github/actions/setup-spark-builder/action.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ inputs:
2424
spark-version:
2525
description: 'The Apache Spark version (e.g., 3.5.7) to build'
2626
required: true
27+
skip-native-build:
28+
description: 'Skip native build (when using pre-built artifact)'
29+
required: false
30+
default: 'false'
2731
runs:
2832
using: "composite"
2933
steps:
@@ -51,7 +55,15 @@ runs:
5155
restore-keys: |
5256
${{ runner.os }}-spark-sql-
5357
54-
- name: Build Comet
58+
- name: Build Comet (with native)
59+
if: ${{ inputs.skip-native-build != 'true' }}
5560
shell: bash
5661
run: |
5762
PROFILES="-Pspark-${{inputs.spark-short-version}}" make release
63+
64+
- name: Build Comet (Maven only, skip native)
65+
if: ${{ inputs.skip-native-build == 'true' }}
66+
shell: bash
67+
run: |
68+
# Native library should already be in native/target/release/
69+
./mvnw install -Prelease -DskipTests -Pspark-${{inputs.spark-short-version}}

.github/workflows/spark_sql_test.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,47 @@ env:
5252
RUST_VERSION: stable
5353

5454
jobs:
55+
56+
# Build native library once and share with all test jobs
57+
build-native:
58+
name: Build Native Library
59+
runs-on: ubuntu-24.04
60+
container:
61+
image: amd64/rust
62+
steps:
63+
- uses: actions/checkout@v6
64+
65+
- name: Setup Rust toolchain
66+
uses: ./.github/actions/setup-builder
67+
with:
68+
rust-version: ${{ env.RUST_VERSION }}
69+
jdk-version: 17
70+
71+
- name: Cache Cargo
72+
uses: actions/cache@v4
73+
with:
74+
path: |
75+
~/.cargo/registry
76+
~/.cargo/git
77+
native/target
78+
key: ${{ runner.os }}-cargo-ci-${{ hashFiles('native/**/Cargo.lock', 'native/**/Cargo.toml') }}
79+
restore-keys: |
80+
${{ runner.os }}-cargo-ci-
81+
82+
- name: Build native library (CI profile)
83+
run: |
84+
cd native
85+
cargo build --profile ci
86+
87+
- name: Upload native library
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: native-lib-linux
91+
path: native/target/ci/libcomet.so
92+
retention-days: 1
93+
5594
spark-sql-auto-scan:
95+
needs: build-native
5696
strategy:
5797
matrix:
5898
os: [ubuntu-24.04]
@@ -81,11 +121,17 @@ jobs:
81121
with:
82122
rust-version: ${{env.RUST_VERSION}}
83123
jdk-version: ${{ matrix.spark-version.java }}
124+
- name: Download native library
125+
uses: actions/download-artifact@v4
126+
with:
127+
name: native-lib-linux
128+
path: native/target/release/
84129
- name: Setup Spark
85130
uses: ./.github/actions/setup-spark-builder
86131
with:
87132
spark-version: ${{ matrix.spark-version.full }}
88133
spark-short-version: ${{ matrix.spark-version.short }}
134+
skip-native-build: true
89135
- name: Run Spark tests
90136
run: |
91137
cd apache-spark
@@ -105,6 +151,7 @@ jobs:
105151
path: "**/fallback.log"
106152

107153
spark-sql-native-native-comet:
154+
needs: build-native
108155
strategy:
109156
matrix:
110157
os: [ ubuntu-24.04 ]
@@ -130,11 +177,17 @@ jobs:
130177
with:
131178
rust-version: ${{env.RUST_VERSION}}
132179
jdk-version: ${{ matrix.java-version }}
180+
- name: Download native library
181+
uses: actions/download-artifact@v4
182+
with:
183+
name: native-lib-linux
184+
path: native/target/release/
133185
- name: Setup Spark
134186
uses: ./.github/actions/setup-spark-builder
135187
with:
136188
spark-version: ${{ matrix.spark-version.full }}
137189
spark-short-version: ${{ matrix.spark-version.short }}
190+
skip-native-build: true
138191
- name: Run Spark tests
139192
run: |
140193
cd apache-spark
@@ -154,6 +207,7 @@ jobs:
154207
path: "**/fallback.log"
155208

156209
spark-sql-native-iceberg-compat:
210+
needs: build-native
157211
strategy:
158212
matrix:
159213
os: [ubuntu-24.04]
@@ -179,11 +233,17 @@ jobs:
179233
with:
180234
rust-version: ${{env.RUST_VERSION}}
181235
jdk-version: ${{ matrix.java-version }}
236+
- name: Download native library
237+
uses: actions/download-artifact@v4
238+
with:
239+
name: native-lib-linux
240+
path: native/target/release/
182241
- name: Setup Spark
183242
uses: ./.github/actions/setup-spark-builder
184243
with:
185244
spark-version: ${{ matrix.spark-version.full }}
186245
spark-short-version: ${{ matrix.spark-version.short }}
246+
skip-native-build: true
187247
- name: Run Spark tests
188248
run: |
189249
cd apache-spark

0 commit comments

Comments
 (0)