This is an automated email from the ASF dual-hosted git repository.
HyukjinKwon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark-connect-rust.git
The following commit(s) were added to refs/heads/master by this push:
new 015e49e5 [MINOR][DOCS] Refresh the official-test and CI design notes
to what CI runs today
015e49e5 is described below
commit 015e49e57e81438246f265c532820c046a72682a
Author: Hyukjin Kwon <[email protected]>
AuthorDate: Fri Nov 13 11:34:17 2026 +0900
[MINOR][DOCS] Refresh the official-test and CI design notes to what CI runs
today
### What changes were proposed in this pull request?
This PR rewrites the stale parts of `dev/design/official-tests.md` and
`dev/design/ci.md` to match what the workflows (`.github/workflows/*.yml`) and
`scripts/run_official_tests.py` do today:
- the runner's flags, output and exit codes;
- its transport and drop-in modes;
- test discovery;
- the skip, drift and retry rules;
- the Python 3.11-only jobs;
- the extension build without a wheel;
- the list of workflows and their triggers.
Headings whose names had gone stale are renamed. No other doc links to
them. Two other stale references are fixed too: `dev/design/acceptance.md`
named the superseded `run_official_connect_tests.py`, and AGENTS.md described
`ci.md` as covering golden-proto tests.
### Why are the changes needed?
Both notes described an old runner script, a `--target-pyspark` flag, a
Python 3.9/3.11 matrix and a wheel-based build that CI no longer uses. A reader
who followed them would run commands that fail.
### Does this PR introduce _any_ user-facing change?
No. It only changes internal docs.
### How was this patch tested?
Docs only. Each statement was checked against `.github/workflows/*.yml`,
`scripts/run_official_tests.py` with its plugins and manifests, and
`Cargo.toml`. The runner's usage was checked against its `--help`. The changed
lines are ASCII only.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5.5
This pull request and its description were written by Isaac.
Closes #601 from HyukjinKwon/MINOR-design-docs-refresh.
Authored-by: Hyukjin Kwon <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
---
AGENTS.md | 2 +-
dev/design/acceptance.md | 6 +-
dev/design/ci.md | 230 +++++++++++++++++++----------
dev/design/official-tests.md | 342 +++++++++++++++++++++++++++----------------
4 files changed, 373 insertions(+), 207 deletions(-)
diff --git a/AGENTS.md b/AGENTS.md
index e9af0aaa..dd85c6d3 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -19,7 +19,7 @@ Maintainer- and agent-facing internals live under
[`dev/design/`](./dev/design) (not published on the user docs site):
- `dev/design/architecture.md` - system design, parity strategy, no-stub rule
-- `dev/design/ci.md` - the CI pipeline (golden-proto tests, parity gate)
+- `dev/design/ci.md` - the CI pipeline (its workflows and the parity gate)
- `dev/design/official-tests.md` - the official Apache Spark Connect test
suite approach
- `dev/design/test-harness.md` - the official-test harness
- `dev/design/acceptance.md` - acceptance criteria / definition of done
diff --git a/dev/design/acceptance.md b/dev/design/acceptance.md
index f43b7004..49b84d81 100644
--- a/dev/design/acceptance.md
+++ b/dev/design/acceptance.md
@@ -36,9 +36,9 @@ parity mixins). Tracked as ledger items in the P10
Python-skin phase.
## Incremental measurement (don't wait until the end)
-`scripts/run_official_connect_tests.py` runs a chosen official connect test
file
-against a *target* `pyspark` package on `PYTHONPATH`, pointed at our live dev
-server (`sc://localhost:15002`). As each feature area lands we run its
+`scripts/run_official_tests.py --only <file>` runs a chosen official connect
test
+file against our client and a live dev server (see
`dev/design/official-tests.md`
+for its modes and flags). As each feature area lands we run its
corresponding official test file (e.g. `test_connect_column`,
`test_connect_functions`, `test_connect_dataframe`) and record pass rate. Full
green across all 371 = done.
diff --git a/dev/design/ci.md b/dev/design/ci.md
index 5cbb9d21..023cb338 100644
--- a/dev/design/ci.md
+++ b/dev/design/ci.md
@@ -2,129 +2,191 @@
# CI/CD Strategy
-This document describes the GitHub Actions CI pipeline for the Spark Connect
Rust Client, a Rust-backed drop-in replacement for the PySpark Spark Connect
client.
+This document describes the GitHub Actions CI pipeline for the Spark Connect
Rust Client, a
+Rust-backed drop-in replacement for the PySpark Spark Connect client.
## Overview
-The CI consists of three main workflows:
+The CI consists of these main workflows:
1. **Rust CI** (`.github/workflows/rust.yml`) - Build and test the pure-Rust
crates
-2. **Python Connect Tests** (`.github/workflows/build_python_connect.yml`) -
Build the PyO3 wheel and run Spark Connect integration tests
-3. **Release wheel build checks** (`.github/workflows/wheel-build-checks.yml`)
- Build Linux aarch64 and macOS universal2 wheels using the release recipe
-
-Rust CI and Python Connect Tests run on pushes and pull requests targeting
`master` and `branch-*`. Release wheel build checks run for changes to packaged
Python sources, protocol definitions, dependencies and build configuration, and
can also be dispatched manually.
+2. **Python Connect Parity** (`.github/workflows/build_python_connect.yml`) -
Build the Rust
+ extension and run the official Spark 4.3.0 Connect test suites through it
against a live server
+3. **Release wheel build checks** (`.github/workflows/wheel-build-checks.yml`)
- Build Linux aarch64
+ and macOS universal2 wheels using the release recipe
+4. **Coverage** (`.github/workflows/coverage.yml`) - Rust and Python coverage,
with regression
+ floors
+
+The other workflows are `lint.yml` (rustfmt, clippy, ruff),
`generated-drift.yml`,
+`vendor-drift.yml`, `docs.yml`, `pandas-parity.yml`, `pipelines-parity.yml`
and `release.yml`.
+
+Most workflows run on pushes and pull requests targeting `master` and
`branch-*`. Several also
+accept manual dispatch. `docs.yml` and `wheel-build-checks.yml` run only when
files matching their
+path filters change. The release wheel build checks cover changes to packaged
Python sources,
+protocol definitions, dependencies and build configuration. `release.yml` runs
on a schedule and on
+manual dispatch.
## Rust CI (`rust.yml`)
-**Status**: Expected to be ✅ fully green.
+**Status**: Expected to be fully green.
This workflow validates the pure-Rust implementation:
-- **Build**: Compiles `spark-connect`, `spark-connect-core`, and
`spark-connect-proto` crates (pyspark-rs is excluded from default cargo
operations because it requires maturin + Python environment)
-- **Test**: Runs `cargo test` on `spark-connect` and `spark-connect-core`
-- **No-stub audit**: Runs `scripts/audit_no_stubs.sh` to enforce the "100%
coverage, zero stubs" rule (see [Design notes](architecture.md))
+- **Build**: `cargo build --release` builds the workspace `default-members`
+ (`apache-spark-connect-proto`, `apache-spark-connect-core`,
`apache-spark-connect`,
+ `apache-spark-connect-macros` and `apache-spark-connect-build`).
`pyspark-rs` is not a
+ default member, so the Python workflows build it separately.
+- **Test**: Runs `cargo test` on `apache-spark-connect` and
`apache-spark-connect-core`, then
+ builds and tests `apache-spark-connect` with the `datafusion,polars` features
+- **No-stub audit**: Runs `scripts/audit_no_stubs.sh` to enforce the "100%
coverage, zero stubs"
+ rule (see [Design notes](architecture.md))
+- **Warnings**: The workflow sets `RUSTFLAGS` to `-D warnings`
### Key steps
1. Checkout
-2. Install Rust (stable channel) with caching
+2. Install Rust (stable channel, minimal profile) with caching
3. Install system dependencies (protobuf-compiler)
-4. Build workspace (excluding pyspark-rs)
-5. Test spark-connect and spark-connect-core crates
+4. Build the default members
+5. Test `apache-spark-connect` and `apache-spark-connect-core`, then build and
test with
+ `datafusion,polars`
6. Audit for placeholder/deferred markers
+The same workflow has three more jobs:
+
+- **Core transport tests (aarch64 Linux)** (`ubuntu-24.04-arm`, 20-minute
limit): runs
+ `cargo test --locked -p apache-spark-connect-core --release --lib` for
`aarch64-unknown-linux-gnu`
+- **WASM UDF feature**: installs the `wasm32-unknown-unknown` target and the
Python packages
+ `cloudpickle`, `pyspark`, `wasmtime` and `pyarrow`. It runs the `wasm-udf`
feature tests, builds
+ the WASM examples, and runs the ignored packer test and the WASM runner
tests.
+- **Minimum supported Rust**: `cargo +1.88 check --locked` on the published
crates, with
+ `RUSTFLAGS` cleared
+
This job should always pass; failures indicate incomplete implementation or
test regressions.
-## Python Connect Tests (`build_python_connect.yml`)
+## Python Connect Parity (`build_python_connect.yml`)
+
+**Status**: Gating. The parity and drop-in jobs pass only when every test that
runs passes, except
+the entries in their known-failures manifests.
-**Status**: Expected to start ⚠️ red and improve iteratively as parity
features are implemented.
+This workflow builds the Rust extension (`pyspark-rs`, a PyO3 module) and runs
the official Apache
+Spark 4.3.0 Connect test suites against it. Its four jobs are:
-This workflow builds the PyO3 extension and runs the official Apache Spark
Connect test suite against our Rust-backed client.
+- `connect-parity` ("Connect parity"): the official `sql/tests/connect` files,
run through our Rust
+ transport against a Spark 4.3.0 server
+- `connect-dropin` ("Connect drop-in"): the official Connect suites of `sql`,
`ml`, `errors` and
+ `logger`, run against our drop-in package
+- `connect-e2e` ("Rust behavioral e2e"): the Rust `e2e_*` tests and the WASM
UDF test, against a
+ second server with reattach settings
+- `connect-benchmark` ("E2E benchmark vs reference"):
`scripts/benchmark_e2e.py`, comparing our
+ client with the pip-installed `pyspark==4.3.0`
### Strategy
-The job is matrix-tested across Python versions (3.9, 3.11) to ensure broad
compatibility.
+Every job runs Python 3.11 and JDK 17 (Temurin). The parity job is a matrix
with that single entry.
+The Spark version is pinned by `SPARK_VERSION: "4.3.0"`, and the test files
come from the `v4.3.0`
+tag.
**Expected behavior**:
-- Many tests will fail initially - this is intentional and documents the work
remaining
-- Each failure corresponds to a gap in parity (see `dev/parity/inventory.csv`)
-- The workflow remains stable (doesn't flake) because it's deterministic
(pinned Spark version)
-- As features are implemented and marked `verified` in the parity ledger, test
failures will turn green
-- **Final goal**: 100% of Connect test suite passing
+- Each failure outside the manifest is a gap in parity or a regression. Fix
the client. If the
+ failure is environmental, add it to `scripts/parity_known_failures.txt`,
regenerated with
+ `scripts/gen_parity_skiplist.py`.
+- `scripts/dropin_known_failures.txt` holds only by-design and environmental
entries
+- Only the event-timing-driven streaming files are retried (see
+ [official-tests.md](official-tests.md)). A failure elsewhere fails on its
first occurrence.
+- The parity run reports manifest entries that now pass, so the manifest can
shrink
### Key steps
#### 1. Setup
- Check out the repository
-- Set up Python (3.9, 3.11)
-- Install Rust (stable)
+- Set up Python 3.11 (pip cache) and JDK 17 (Temurin)
+- Install Rust (stable, minimal profile) and cache cargo
- Install system dependencies (protobuf-compiler)
-- Install build tools (pip, setuptools, wheel, maturin)
#### 2. Build the extension
```bash
-maturin build --release --out dist
+cargo build -p pyspark-rs --release
+cp target/release/lib_pyspark.so python/pyspark/_pyspark.so
```
-This produces a wheel (`pyspark_client_rust-4.3.0-*.whl`) containing:
-- The compiled PyO3 extension module (`_pyspark.so` / `.pyd`)
-- The pure-Python drop-in package (`python/pyspark/...`)
+The extension is copied into `python/pyspark/`, so `./python` is a working
package. No wheel is
+built or installed, because the reference `pyspark` and ours both own the
`pyspark` namespace.
#### 3. Install dependencies
```bash
-pip install dist/pyspark_client_rust-*.whl
-pip install pytest pandas pyarrow numpy grpcio cloudpickle
+python -m pip install pytest 'pandas>=2.2,<3.0' pyarrow numpy grpcio
grpcio-status \
+ googleapis-common-protos cloudpickle zstandard py4j 'plotly<6.0.0'
graphviz==0.20.3
```
+The drop-in job installs the same list. The workflow comments give the reason
for the
+pandas 2.x pin: Spark 4.2's tests and Python workers are not compatible with
pandas 3.x.
#### 4. Download & start Spark Connect server (4.3.0)
- Downloads the official Spark 4.3.0 binary distribution with the Connect
server bundled
- (`spark-4.3.0-bin-hadoop3-connect.tgz`)
-- Starts the Connect server on `sc://localhost:15002`
-- Waits for readiness (nc connectivity check, up to 60 seconds)
+ (`spark-4.3.0-bin-hadoop3-connect.tgz`) from archive.apache.org into
`~/spark-dist`, cached
+- Starts the server with `--driver-memory 3g` and
+ `spark.sql.session.localRelationSizeLimit=1073741824` on
`sc://localhost:15002`
+- Waits for readiness (a `/dev/tcp` port check, up to 90 seconds)
#### 5. Clone Apache Spark test suite
-- Clones Apache Spark at tag `v4.3.0`
-- Test files are discovered from `python/pyspark/**/tests/connect/**/test_*.py`
+- Clones Apache Spark at tag `v4.3.0` (`--depth 1`) into `~/spark-source`,
cached
-#### 6. Run Connect test modules
+#### 6. Run the parity gate
```bash
-python scripts/run_official_connect_tests.py \
- --spark <spark-source> \
- --target-pyspark ./python \
+RUST_PYSPARK_SO=$PWD/python/pyspark/_pyspark.so \
+python scripts/run_official_tests.py \
+ --spark ~/spark-source \
--remote sc://localhost:15002 \
- test_connect_column \
- test_connect_functions \
- test_connect_dataframe \
- test_connect_udf \
- ...
+ --jobs 1 \
+ --exclude
"test_artifact.py,test_artifact_localcluster.py,test_parity_resources.py"
```
-The script prepends our package to `PYTHONPATH` and runs pytest against
official Spark test files.
+The runner injects our Rust transport into the official test files (see
+[official-tests.md](official-tests.md)). The same job then:
+- runs the drop-in-facing live-server pytest files under `python/tests`
+ (`test_arrow_e2e.py`, `test_dropin_e2e.py` and the ML e2e files)
+- restarts the server in `local-cluster[2, 4, 1024]` mode and runs the
resource and artifact
+ files with `--only` and `--no-drift-check`
#### 7. Artifact upload
-- Uploads Connect test log (`/tmp/connect-tests.log`)
-- Uploads Connect server log (`/tmp/connect-server.log`)
+- Uploads the parity logs (`/tmp/parity-test-logs/`, `/tmp/parity_ours.log`,
+ `/tmp/parity_localcluster.log`) and both server logs as the
`parity-ours-py3.11` artifact
These logs are available in the workflow run artifacts for debugging failures.
-### Expected test modules
-
-The workflow currently runs:
-- `test_connect_column` - Column and expression operations
-- `test_connect_functions` - SQL functions
-- `test_connect_dataframe` - DataFrame operations
-- `test_connect_udf` - Python and pandas UDFs
-
-Additional modules can be added as parity improves (e.g.,
`test_connect_readwriter`, `test_connect_udf_batch`, etc.).
+### Other jobs
+
+- **connect-dropin**: the same setup, without the transport. It runs
+ `scripts/run_official_tests.py --dropin --jobs 1` against the server started
from `SPARK_HOME`.
+ Its known failures are in `scripts/dropin_known_failures.txt`. Its logs are
uploaded as the
+ `dropin-official-py3.11` artifact.
+- **connect-e2e**: starts a second server with
+ `spark.connect.execute.reattachable.senderMaxStreamSize=1048576`, so that
results over
+ 1 MiB exercise the reattach path. It runs `cargo test -p
apache-spark-connect` on the `e2e_*`
+ tests and a set of other integration tests with `--test-threads=1`, then the
+ `e2e_wasm_udf` test in `tests/wasm-udf`.
+- **connect-benchmark**: builds the extension and starts a server with default
settings. It runs
+ `scripts/benchmark_e2e.py --isolate` for the reference (pip-installed
`pyspark==4.3.0`) and for
+ ours (`PYTHONPATH=$(pwd)/python`), then `--compare`.
+
+### Test selection
+
+The parity job discovers every `test_*.py` under `<spark>/python` whose path
contains
+`/sql/tests/connect/`, minus the three local-cluster-only basenames. The
drop-in job discovers
+the Connect suites of `pyspark/sql`, `pyspark/ml`, `pyspark/errors` and
`pyspark/logger`. Apart
+from the local-cluster phase's `--only` list, no module is named by hand. See
+[official-tests.md](official-tests.md) for the selection, skip and retry rules.
### Handling test failures
Each failing test is a **gap in parity**. The fix process:
-1. **Identify the gap**: Read the test failure and corresponding official code
+1. **Identify the gap**: Read the test failure and corresponding official
code. The job log
+ lists the unexpected failures at the end of the run.
2. **Locate the ledger row**: Find the symbol in `dev/parity/inventory.csv`
3. **Implement the feature**: Code the missing functionality in the Rust crate
-4. **Update ledger status**: Mark the row `done` (or `verified` if a golden
proto is included)
-5. **Verify locally**: Run `scripts/run_official_connect_tests.py` with
`--target-pyspark ./python`
+4. **Update ledger status**: Mark the row `done` (or `verified`; see
Continuous improvement)
+5. **Verify locally**: Run `scripts/run_official_tests.py --only <module>` (see
+ [official-tests.md](official-tests.md))
6. **Push & verify CI**: The workflow will show the test passing on the next
run
## Release wheel build checks (`wheel-build-checks.yml`)
@@ -163,8 +225,10 @@ This workflow runs on pushes and pull requests targeting
`master` and `branch-*`
one job does three things:
- **Rust coverage**: `cargo llvm-cov` over the unit and golden tests of
- `apache-spark-connect` and `apache-spark-connect-core`, plus the behavioral
e2e tests
- against a live Connect server, merged into one report.
+ `apache-spark-connect` and `apache-spark-connect-core`, plus nine behavioral
e2e test
+ files (`e2e_functions`, `e2e_columns`, `e2e_dataframe`, `e2e_coverage`,
`e2e_integration`,
+ `e2e_streaming`, `e2e_new_methods`, `e2e_ops_breadth`,
`e2e_session_catalog`) against a live
+ Connect server, merged into one report.
- **Offline Python suite**: builds the extension and runs
`python/tests/test_dropin_offline.py`, `test_arrow_handoff.py` and
`test_ml_offline.py`
under `coverage.py`. No other workflow runs these files, so this step is
their gate: a
@@ -187,49 +251,57 @@ the README badges read.
## Continuous improvement
-The parity ledger (`dev/parity/inventory.csv`) is the source of truth:
-- **todo**: Not started
-- **wip**: In progress, not testable yet
+The parity ledger (`dev/parity/inventory.csv`) is the source of truth. Its
status values in use are:
+- **todo**: Not started. `scripts/gen_parity_ledger.py` gives new rows this
status.
- **done**: Implemented, test(s) passing but not yet officially verified
- **verified**: Backed by golden-proto match and/or all-green Connect test
suite
+- **n/a**: Not applicable to the client. The notes column gives the reason,
for example
+ `architecture-satisfied`.
-The CI workflow gates progress:
+The CI workflows gate progress:
- Rust CI ensures the core crates are always buildable and testable
-- Connect CI documents which official tests are green (and which are red)
-- `audit_no_stubs.sh` enforces the "no TODOs" rule before claiming completion
+- The Connect parity and drop-in jobs fail on any official test outside their
known-failures
+ manifests
+- `audit_no_stubs.sh` (run in Rust CI) fails on placeholder markers such as
`TODO` or `FIXME` in
+ `crates/*/src`
## Running tests locally
To run the Connect test suite locally:
-1. **Build and install the wheel**:
+1. **Build the extension**:
```bash
- maturin build --release --out dist
- pip install dist/pyspark_client_rust-*.whl
+ cargo build -p pyspark-rs --release
+ cp target/release/lib_pyspark.so python/pyspark/_pyspark.so
```
-2. **Start a Spark Connect server** (requires Java + Spark 4.3.0):
+2. **Start a Spark Connect server** (requires Java 17 and the Spark 4.3.0
bin-hadoop3-connect
+ distribution):
```bash
# In one terminal:
export SPARK_HOME=~/spark-dist/spark-4.3.0-bin-hadoop3-connect
- ${SPARK_HOME}/sbin/start-connect-server.sh
+ ${SPARK_HOME}/sbin/start-connect-server.sh \
+ --driver-memory 3g \
+ --conf spark.sql.session.localRelationSizeLimit=1073741824
```
-3. **Run the test suite**:
+3. **Run a test module** (install the Python dependencies listed under
Strategy first):
```bash
- pip install pytest
- python scripts/run_official_connect_tests.py \
+ RUST_PYSPARK_SO=$PWD/python/pyspark/_pyspark.so \
+ python scripts/run_official_tests.py \
--spark /path/to/spark \
- --target-pyspark ./python \
--remote sc://localhost:15002 \
- test_connect_column
+ --only pyspark.sql.tests.connect.test_parity_dataframe
```
+See [official-tests.md](official-tests.md) for the flags, the output format
and the skip rules.
+
## References
- [Design notes](architecture.md) - System design, parity strategy, no-stub
rule
- [Acceptance criteria](acceptance.md) - Acceptance criteria and definition of
done
-
[pyproject.toml](https://github.com/apache/spark-connect-rust/blob/master/pyproject.toml)
- Maturin build configuration
--
[scripts/run_official_connect_tests.py](https://github.com/apache/spark-connect-rust/blob/master/scripts/run_official_connect_tests.py)
- Test runner utility
+- [Official tests](official-tests.md) - The official-test runner, its modes
and its skip rules
+-
[scripts/run_official_tests.py](https://github.com/apache/spark-connect-rust/blob/master/scripts/run_official_tests.py)
- Test runner utility
-
[scripts/audit_no_stubs.sh](https://github.com/apache/spark-connect-rust/blob/master/scripts/audit_no_stubs.sh)
- No-stub audit gate
- [Apache Spark
Workflow](https://github.com/apache/spark/blob/master/.github/workflows/build_python_connect.yml)
- Reference implementation
diff --git a/dev/design/official-tests.md b/dev/design/official-tests.md
index b4fe7394..758a01be 100644
--- a/dev/design/official-tests.md
+++ b/dev/design/official-tests.md
@@ -1,216 +1,310 @@
# Official Spark Connect Tests
-This document describes how to run Apache Spark's official PySpark Connect
tests against our drop-in package.
+This document describes how to run Apache Spark's official PySpark Connect
tests against our
+Rust-backed client and our drop-in package.
## Overview
-The **Official Tests gate** validates that our Rust-backed PySpark Connect
client achieves **parity** with Apache Spark's reference implementation by
running the entire official test suite (371 test modules across 4 test
categories).
+The **Official Tests gate** validates that our Rust-backed PySpark Connect
client achieves
+**parity** with Apache Spark's reference implementation. It runs the official
Spark 4.3.0 Connect
+test files against a live Spark 4.3.0 Connect server, in one of two modes:
-- **Manifest**: `tests/official/connect_test_modules.txt` lists all 371
official test modules
-- **Script**: `scripts/run_official_connect_tests.py` runs tests against a
Connect server
-- **Requirements**: `requirements-connect-test.txt` specifies pip dependencies
+- **Transport mode** (default): the official test files run on the reference
`pyspark`, and our Rust
+ transport (`scripts/rust_transport_plugin.py`) replaces its gRPC stub. This
is the
+ `connect-parity` job.
+- **Drop-in mode** (`--dropin`): the official test files run against our own
`pyspark` drop-in (the
+ Rust-backed DataFrame, Column, functions, readers, ...). This is the
`connect-dropin` job.
-## Test Modules
-
-The manifest (`tests/official/connect_test_modules.txt`) is organized by
module category:
+- **Runner**: `scripts/run_official_tests.py`
+- **CI**: `.github/workflows/build_python_connect.yml`
+- **Known failures**: `scripts/parity_known_failures.txt` (transport mode) and
+ `scripts/dropin_known_failures.txt` (drop-in mode)
-1. **pyspark-connect** (96 modules)
- - Core SQL/Connect doctests and unit tests
- - Arrow UDF tests, client tests, parity tests
+## Test Modules
-2. **pyspark-ml-connect** (24 modules)
- - ML/Connect doctests and unit tests
- - Feature engineering, classification, regression, clustering, pipelines
+The gate discovers test files on disk. It does not read a module list.
-3. **pyspark-pandas-connect** (131 modules)
- - Pandas-on-Spark Connect tests
- - DataFrame operations, type operations, plotting, reshaping, groupby, I/O
+- **Transport mode**: every `test_*.py` under the Spark `python/` tree whose
path contains
+ `/sql/tests/connect/`. CI passes `--exclude` for the three
local-cluster-only basenames
+ (`test_artifact.py`, `test_artifact_localcluster.py`,
`test_parity_resources.py`), and the
+ local-cluster step runs those with `--only`.
+- **Drop-in mode**: every `test_*.py` under the Connect suites of
`pyspark/sql`,
+ `pyspark/ml`, `pyspark/errors` and `pyspark/logger`, minus the same three
basenames.
-4. **pyspark-pandas-slow-connect** (120 modules)
- - Slower Pandas-on-Spark tests (indexes, diff_frames_ops, groupby
operations)
+The pandas and pipelines suites are not run by this runner.
`pandas-parity.yml` and
+`pipelines-parity.yml` run their own pytest commands.
-**Total: 371 test modules**
+`tests/official/connect_test_modules.txt` is a reference list of 371 module
names in four
+groups: pyspark-connect (96), pyspark-ml-connect (24), pyspark-pandas-connect
(131) and
+pyspark-pandas-slow-connect (120). Its header names Spark's
`dev/sparktestsupport/modules.py`
+as the source. No workflow runs it, and `run_official_tests.py` does not read
it. Only
+`scripts/run_official_connect_tests.py`, which CI does not call, reads it.
## Running Tests Locally
### Prerequisites
-1. **Spark source** at `/path/to/spark` (or specify via `--spark`)
-2. **Spark Connect server** running on `sc://localhost:15002` (default)
-3. **Dependencies installed**: `pip install -r requirements-connect-test.txt`
-4. **Our package on PYTHONPATH** (or use `--target-pyspark /path/to/python`)
+1. **Spark source** at `/path/to/spark`: a v4.3.0 checkout with a `python/`
directory (`--spark`)
+2. **Spark Connect server** running on `sc://localhost:15002` (the default;
override with
+ `--remote` or `SPARK_CONNECT_TESTING_REMOTE`)
+3. **Python dependencies** as the CI job installs them: pytest,
`pandas>=2.2,<3.0`, pyarrow,
+ numpy, grpcio, grpcio-status, googleapis-common-protos, cloudpickle,
zstandard, py4j,
+ `plotly<6.0.0` and `graphviz==0.20.3`
+4. **Built extension** at `RUST_PYSPARK_SO`, required in both modes:
+ ```bash
+ cargo build -p pyspark-rs --release
+ cp target/release/lib_pyspark.so python/pyspark/_pyspark.so
+ export RUST_PYSPARK_SO=$PWD/python/pyspark/_pyspark.so
+ ```
+ On macOS, copy the `.dylib` that cargo writes instead.
+
+Our package does not need to be installed. Transport mode imports the
reference `pyspark`
+from `--spark`, and drop-in mode imports an overlay of our `python/` tree.
### Quick Test (Single Module)
```bash
-python3 scripts/run_official_connect_tests.py \
+python3 scripts/run_official_tests.py \
--spark /path/to/spark \
- pyspark.sql.tests.connect.test_connect_basic
+ --only pyspark.sql.tests.connect.test_parity_dataframe
```
+`--only` takes dotted module names or `python/`-relative `.py` paths.
+
### Run All Official Tests
```bash
-python3 scripts/run_official_connect_tests.py \
+python3 scripts/run_official_tests.py \
--spark /path/to/spark \
- --modules-file tests/official/connect_test_modules.txt
+ --jobs 1 \
+ --exclude
"test_artifact.py,test_artifact_localcluster.py,test_parity_resources.py"
```
### Against Our Drop-In Package
```bash
-python3 scripts/run_official_connect_tests.py \
+python3 scripts/run_official_tests.py \
+ --dropin \
--spark /path/to/spark \
- --target-pyspark python/pyspark \
- --modules-file tests/official/connect_test_modules.txt
+ --jobs 1
```
## Running Tests in CI
-The CI workflow integrates this test gate following Spark's
`build_python_connect.yml` approach:
+The `connect-parity` and `connect-dropin` jobs in
`.github/workflows/build_python_connect.yml`
+run this gate. Both use Python 3.11 and JDK 17 (Temurin), run files serially
(`--jobs 1`), and
+test against a Spark 4.3.0 Connect server.
### CI Setup Steps
-1. **Build our wheel** from Python package
-2. **Install wheel** into CI environment
-3. **Remove bundled pyspark.zip/py4j** to ensure pure-client mode
-4. **Point PYTHONPATH** at our installed package
-5. **Start Spark 4.3.0 Connect server** (configured as needed)
-6. **Run test script** against the manifest
+1. **Build the extension** with `cargo build -p pyspark-rs --release` and copy
it to
+ `python/pyspark/_pyspark.so`. No wheel is built or installed, because the
reference
+ `pyspark` and ours both own the `pyspark` namespace.
+2. **Install Python dependencies** inline in the workflow. It does not install
+ `requirements-connect-test.txt`.
+3. **Download Spark 4.3.0** (`spark-4.3.0-bin-hadoop3-connect.tgz` from
archive.apache.org,
+ cached in `~/spark-dist`) and start its Connect server with
`--driver-memory 3g` and
+ `spark.sql.session.localRelationSizeLimit=1073741824`. The job waits up to
90 seconds for
+ port 15002. The drop-in job starts the server from `SPARK_HOME`, because
the ML tests read
+ relative data paths.
+4. **Clone Apache Spark v4.3.0** (`--depth 1`, cached in `~/spark-source`) for
the test files
+ and the reference `pyspark`.
+5. **Run the runner** with `RUST_PYSPARK_SO` set. The parity job then restarts
the server in
+ `local-cluster[2, 4, 1024]` mode and runs the resource and artifact files
with `--only`
+ and `--no-drift-check`.
### CI Command (Reference)
```bash
-# Install deps
-pip install -r requirements-connect-test.txt
-pip install dist/pyspark_client_rust-*.whl
-
-# Remove bundled Java libraries to force pure-client mode
-rm -rf $(python3 -c "import pyspark;
print(pyspark.__path__[0])")/{lib,pyspark.zip}
-
-# Start Connect server (in background)
-export PYTHONPATH="<spark>/python"
-./sbin/start-connect-server.sh --driver-java-options "..." ...
-
-# Run ALL tests from manifest
-python3 scripts/run_official_connect_tests.py \
- --spark /path/to/spark \
- --target-pyspark $(python3 -c "import pyspark;
print(pyspark.__path__[0])") \
- --modules-file tests/official/connect_test_modules.txt
-
-# Stop server
-./sbin/stop-connect-server.sh
+# Build the extension and place it where the overlay expects it
+cargo build -p pyspark-rs --release
+cp target/release/lib_pyspark.so python/pyspark/_pyspark.so
+
+# Start the Connect server (Spark 4.3.0 binary distribution)
+"${SPARK_HOME}/sbin/start-connect-server.sh" \
+ --driver-memory 3g \
+ --conf spark.sql.session.localRelationSizeLimit=1073741824
+
+# Transport mode: official files through our Rust client
+RUST_PYSPARK_SO=$PWD/python/pyspark/_pyspark.so \
+SPARK_CONNECT_TESTING_REMOTE=sc://localhost:15002 \
+python3 scripts/run_official_tests.py \
+ --spark ~/spark-source --jobs 1 \
+ --exclude
"test_artifact.py,test_artifact_localcluster.py,test_parity_resources.py"
+
+# Drop-in mode: official files against our drop-in
+RUST_PYSPARK_SO=$PWD/python/pyspark/_pyspark.so \
+SPARK_CONNECT_TESTING_REMOTE=sc://localhost:15002 \
+python3 scripts/run_official_tests.py --dropin --spark ~/spark-source --jobs 1
```
## Script Usage
-### run_official_connect_tests.py
+### run_official_tests.py
```
-usage: run_official_connect_tests.py [-h] --spark SPARK [--remote REMOTE]
- [--target-pyspark TARGET_PYSPARK]
- [--modules-file MODULES_FILE]
- [names ...]
+usage: run_official_tests.py [-h] --spark SPARK [--remote REMOTE] [--dropin]
+ [--manifest MANIFEST] [--jobs JOBS]
+ [--timeout TIMEOUT] [--retries RETRIES]
+ [--no-drift-check] [--only ONLY] [--exclude
EXCLUDE]
Arguments:
--spark SPARK
- Path to Spark source checkout (required)
-
+ Spark source tree that has a python/ directory (required)
+
--remote REMOTE
Spark Connect server endpoint
- Default: sc://localhost:15002
-
- --target-pyspark TARGET_PYSPARK
- Directory to prepend to PYTHONPATH
- Use for testing our drop-in replacement package
- Optional: if not set, uses Spark's pyspark from PYTHONPATH
-
- --modules-file MODULES_FILE
- File with list of test modules to run (one per line)
- Supports # comments and blank lines
- Example: tests/official/connect_test_modules.txt
-
- names
- Test module names (positional)
- Use either this OR --modules-file, not both
- Example: pyspark.sql.tests.connect.test_connect_basic
+ Default: $SPARK_CONNECT_TESTING_REMOTE, else sc://localhost:15002
+
+ --dropin
+ Run the official sql, ml, errors and logger Connect suites against our
drop-in
+ (an overlay of our python/ tree) instead of through the transport
+
+ --manifest MANIFEST
+ Known-failure manifest
+ Default: scripts/parity_known_failures.txt, or
scripts/dropin_known_failures.txt
+ with --dropin
+
+ --jobs JOBS
+ Files to run in parallel. Default: 1 (CI runs serially)
+
+ --timeout TIMEOUT
+ Per-file timeout in seconds. Default: 360
+
+ --retries RETRIES
+ Extra attempts for the event-timing-driven files only (FLAKY_FILES).
Default: 2
+
+ --no-drift-check
+ Skip the post-run check that reports manifest entries that now pass
+
+ --only ONLY
+ Run only these tests instead of discovering them. Comma-separated dotted
module
+ names (pyspark.sql.tests.connect.test_parity_dataframe) or
python/-relative .py paths
+
+ --exclude EXCLUDE
+ Comma-separated test-file basenames to drop from discovery (ignored with
--only)
```
+The runner needs `RUST_PYSPARK_SO` in the environment. Exit codes are 0 when
no file has
+unexpected failures, 1 when a file does, and 2 for setup errors:
`RUST_PYSPARK_SO` unset, an
+`--only` file not found, or no test files discovered.
+
### Output
-The script reports:
-- Each module name and file path as it runs
-- Pass/fail status via pytest return code
-- Summary at the end:
- ```
- ======================================================================
- Test Summary: 371 modules
- Passed: 365
- Failed: 5
- Not found: 1
- ======================================================================
- ```
+The script prints:
+- `Discovered N connect test files; manifest skips X tests + Y whole files.`
+- One line per file, in discovery order:
+ `[done/total] ok|FAIL|skip(env) <basename> p=<passed> f=<failed>
e=<errors> skip=<skipped>`,
+ with optional ` TIMEOUT`, ` rc=<n>` and ` (after <k> attempts)` suffixes
+- A drift check, printed only when a manifest entry now passes. It never fails
the run.
+- `<n> file(s) with unexpected failures out of <N>.` On failure, the node ids
of the
+ unexpected failures follow.
+
+When `RUST_PARITY_LOG_DIR` is set, each pytest attempt is kept there,
including tracebacks,
+retries and drift-check runs.
+
+## Selection, Skips and Retries
+
+- **Known-failure manifest**: a line `<relpath>::Class::method # reason`
deselects that test.
+ The plugin matches the node-id suffix, and also a parametrized `[param]`
variant. A line
+ without `::` skips the whole file. The drop-in manifest uses this for the
gRPC client
+ internals files. Each manifest's header gives the format.
+- **Manifest maintenance**: `scripts/gen_parity_skiplist.py` regenerates the
parity manifest,
+ and it runs the reference client to do so. Only by-design and environmental
entries belong
+ in the drop-in manifest, per its header.
+- **Drift check**: after the run, every manifest test is re-run in select-only
mode. Tests
+ that now pass are listed, so the manifest can shrink. The check never fails
the gate.
+- **Retries**: only the basenames in `FLAKY_FILES` are retried, up to
`--retries` extra
+ attempts. These are the event-timing-driven streaming files, such as
+ `test_parity_streaming.py`, `test_parity_listener.py` and
`test_parity_observation.py`.
+ All other files run once.
+- **Timeouts**: `--timeout` (360 seconds) applies to each file.
`test_parity_arrow_python_udf.py`
+ and `test_parity_udtf.py` get 1200 seconds.
+- **Pass or fail per file**: a file fails when pytest exits nonzero, when it
times out, or
+ when its summary shows failures or errors. Exit code 5 (no tests collected)
counts as ok.
+- **Drop-in mode**: the runner removes `SPARK_SKIP_CONNECT_COMPAT_TESTS` from
the test
+ environment, because the official Arrow UDTF suite skips itself when it is
set.
## Environment Variables
-The script sets these for test execution:
+The runner sets these for each pytest run:
| Variable | Value | Purpose |
|----------|-------|---------|
-| `SPARK_CONNECT_TESTING_REMOTE` | `sc://localhost:15002` | Connect server
endpoint |
+| `SPARK_CONNECT_TESTING_REMOTE` | `--remote` value | Connect server endpoint |
| `SPARK_TESTING` | `1` | Enable Spark test mode |
-| `SPARK_CONNECT_MODE_ENABLED` | `1` | Force pure-client mode (no local JVM) |
-| `PYTHONPATH` | Target + Spark + original | Prioritize our package |
+| `PYTHONHASHSEED` | `0` | Fixed hash seed, so ML CrossValidator splits are
stable |
+| `SPARK_SKIP_CONNECT_COMPAT_TESTS` | `1`, removed in drop-in mode |
Remote-only session |
+| `PYTHONPATH` | Transport: scripts, Spark python; drop-in: overlay, scripts |
Plugins first |
+| `RUST_PYSPARK_SO` | Set by the caller | Path to the built `_pyspark`
extension |
+| `RUST_PARITY_DESELECT`, `RUST_PARITY_SELECT_ONLY` | Set by the runner |
Deselect plugin input |
+| `RUST_PARITY_LOG_DIR` | Set by the caller (optional) | Keeps each pytest
attempt's log |
## Troubleshooting
-### "test file not found: X"
+### "--only test file(s) not found"
+
+The runner exits with status 2 before running anything. Check:
+1. The module name maps to a file under `<spark>/python/`. For example,
+ `pyspark.sql.tests.connect.test_parity_dataframe` maps to
+ `python/pyspark/sql/tests/connect/test_parity_dataframe.py`.
+2. The Spark source is the v4.3.0 checkout.
-The module name might not match the actual file. Check:
-1. Module is listed in `tests/official/connect_test_modules.txt`
-2. Module exists under `<spark>/python/pyspark/**/tests/connect/**/`
-3. Module name matches test file (e.g., `test_connect_basic` ->
`test_connect_basic.py`)
+Without `--only`, the runner discovers the files itself, so this error does
not occur.
### "Connection refused" to Spark Connect server
-The server must be running on the endpoint specified by `--remote`:
-1. Verify server is started
-2. Check endpoint matches (default: `sc://localhost:15002`)
-3. Use `--remote sc://...` if on different host/port
+The runner does not check the endpoint, so a missing server appears as test
failures:
+1. Verify the server is started (CI waits up to 90 seconds on port 15002)
+2. Check the endpoint matches `--remote` (default `sc://localhost:15002`, or
+ `SPARK_CONNECT_TESTING_REMOTE`)
+3. Use `--remote sc://...` if the server is on a different host or port
-### "ModuleNotFoundError" for our package
+### "set RUST_PYSPARK_SO" or the extension is missing
-Our package must be on PYTHONPATH:
-1. Use `--target-pyspark /path/to/python` if not installed
-2. Or: `export PYTHONPATH="/path/to/python:$PYTHONPATH"` before running
-3. Ensure wheel is installed correctly in CI
+The runner exits with status 2 when `RUST_PYSPARK_SO` is unset. The transport
plugin raises
+`RuntimeError` when the path does not exist. Build the extension and export
the path, as in
+Prerequisites.
### Tests pass locally but fail in CI
-Check environment differences:
-1. **Python version**: Must match (3.11 in official CI)
-2. **Spark version**: Must be 4.3.0+
-3. **Dependencies**: All versions in `requirements-connect-test.txt` installed
-4. **Connect server**: Same configuration as local testing
+1. **Python version**: 3.11 in both CI jobs
+2. **Spark version**: the v4.3.0 tag for the test files, and the 4.3.0
bin-hadoop3-connect server
+3. **Dependencies**: the list in Prerequisites, as the CI job installs it
+4. **Server settings**: `--driver-memory 3g` and `localRelationSizeLimit`. CI
runs the gate
+ serially (`--jobs 1`).
+5. **Timing**: only the streaming files are retried. A timing flake elsewhere
fails on its first
+ attempt, so a single local run can pass where CI fails.
## Integration with acceptance.md
-This gate is part of the broader **Acceptance Criteria**:
-- **Baseline**: Validates official tests pass with reference client
-- **Gating**: Required before shipping our package
-- **Cadence**: Runs in CI on every merge
+This gate is part of the broader **Acceptance Criteria** in `acceptance.md`:
+- **Baseline**: the gate no longer runs the reference client on every file.
The reference
+ client runs only when `scripts/gen_parity_skiplist.py` regenerates the
manifest.
+- **Gating**: the `connect-parity` and `connect-dropin` jobs fail on any
unexpected failure
+- **Cadence**: runs on every push and pull request to `master` and `branch-*`,
and on
+ manual dispatch
See `acceptance.md` for the full acceptance criteria framework.
## Files
-- `tests/official/connect_test_modules.txt` - Manifest of all 371 test modules
-- `scripts/run_official_connect_tests.py` - Script to execute tests
-- `requirements-connect-test.txt` - Pip dependencies
+- `tests/official/connect_test_modules.txt` - Reference list of 371 module
names (not read by the
+ gate)
+- `requirements-connect-test.txt` - Pip pins copied from an older Apache
workflow (CI does not
+ install it)
+- `scripts/run_official_tests.py` - Runner for both modes
+- `scripts/rust_transport_plugin.py` - Pytest plugin that injects our Rust
transport (transport
+ mode)
+- `scripts/dropin_deselect_plugin.py` - Pytest plugin that applies the
manifest (drop-in mode)
+- `scripts/parity_known_failures.txt` - Known-failure manifest, transport mode
+- `scripts/dropin_known_failures.txt` - Known-failure manifest, drop-in mode
+- `scripts/gen_parity_skiplist.py` - Regenerates the transport-mode manifest
+- `.github/workflows/build_python_connect.yml` - CI workflow
- `official-tests.md` - This document
## References
- Apache Spark: https://github.com/apache/spark
-- Reference workflow: `.github/workflows/build_python_connect.yml`
-- Module definitions: `dev/sparktestsupport/modules.py`
+- Apache Spark's `.github/workflows/build_python_connect.yml`, which this
workflow mirrors
+- Module source named in the manifest header:
`dev/sparktestsupport/modules.py` in apache/spark
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]