[DO NOT MERGE] Import Spark Connect Gateway reference implementation - #1
[DO NOT MERGE] Import Spark Connect Gateway reference implementation#1viirya wants to merge 1 commit into
Conversation
…roto crate ### What changes were proposed in this pull request? This is the first of a series of small, bottom-up PRs importing the Spark Connect Gateway reference implementation (tracked in the do-not-merge reference PR #1). It introduces the Cargo workspace: - Root `Cargo.toml` with the full `[workspace.package]` and `[workspace.dependencies]` tables. `members` lists only `crates/genproto` for now; subsequent PRs append one or more crates. - `Cargo.lock` (tracked — this project ships a binary), `rust-toolchain.toml`. - The vendored `spark.connect.*` protos under `proto/spark/connect/` — a read-only mirror of the corresponding files in `apache/spark`. - The `scg-genproto` crate, whose `build.rs` generates tonic bindings from the protos at build time via `tonic-prost-build`. Each PR in this series keeps `main` green under the full CI matrix (fmt / clippy --all-targets / build / test --workspace). ### Why are the changes needed? Implements the reference gateway from the approved SPIP (SPARK-58455), imported into the `apache/spark-connect-gateway` subproject repo one reviewable piece at a time. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? `cargo fmt --all --check`, `cargo clippy --workspace --all-targets -- -D warnings`, `cargo build --workspace`, and `cargo test --workspace` all pass locally. ### Was this patch authored or co-authored using generative AI tooling? Yes, co-authored with Claude Code. Closes #2 from viirya/import-01-genproto. Authored-by: Liang-Chi Hsieh <viirya@gmail.com> Signed-off-by: Liang-Chi Hsieh <liangchi.hsieh@databricks.com>
1062732 to
ae8c73b
Compare
### What changes were proposed in this pull request? Part of importing the Spark Connect Gateway reference implementation into `apache/spark-connect-gateway` as a series of small, bottom-up PRs (tracked in the do-not-merge reference PR #1). This adds the `scg-routing` crate — the routing core of the gateway. It defines the central traits and types that the pool and store layers implement and that the proxy routes through: - `SessionKey` — the routing key derived from a request - `Pool` — the backend-pool trait (implemented later by pool-static / pool-k8s) - `AffinityStore` — the session-affinity store trait (implemented later by store-memory / store-redis) - `Router` — ties them together `scg-routing` is a leaf crate (no internal dependencies), so it compiles and tests on its own. It is appended to the workspace `members` list. Subsequent PRs add the crates that depend on it. ### Why are the changes needed? Implements the reference gateway from the approved SPIP (SPARK-58455), imported one reviewable piece at a time. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? `cargo fmt --all --check`, `cargo clippy --workspace --all-targets -- -D warnings`, `cargo build --workspace`, and `cargo test --workspace` all pass locally (scg-routing has 15 unit tests). ### Was this patch authored or co-authored using generative AI tooling? Yes, co-authored with Claude Code. Closes #3 from viirya/import-02-routing. Authored-by: Liang-Chi Hsieh <viirya@gmail.com> Signed-off-by: Liang-Chi Hsieh <liangchi.hsieh@databricks.com>
Reference implementation imported from the development repo as a single squashed commit. This is intentionally too large to review and is NOT meant to be merged — it exists as the target end-state so reviewers can see the whole picture. It will be split into smaller, reviewable PRs that land one at a time; this branch is rebased and shrinks as each split PR merges. Every source file carries the Apache license header; the vendored spark.connect.* protos under proto/ retain their upstream ASF headers. Co-authored-by: Claude Code
ae8c73b to
ed772da
Compare
|
The routing crate landing gives the user-aware placement piece a home, and I have it ready against It fails closed rather than falling back to round-robin because a wrong placement is not an affinity miss. Spark Connect never uses This is the strategy half only. The other half — labels reaching the pool from discovery — has nothing to attach to yet, since I can't create a SPARK sub-task myself. Could you file one under SPARK-58455 whenever it fits your import order, or point me at a better venue for the patch? |
What changes were proposed in this pull request?
This PR imports the full Spark Connect Gateway reference implementation as a
single squashed commit.
This PR is intentionally too large to review and is NOT meant to be merged.
It exists only as the reference / target end-state so reviewers can see the whole
picture. The implementation will be split into smaller, self-contained,
reviewable PRs that land one at a time (in dependency order, bottom-up). After
each small PR merges, this reference PR is rebased and shrinks until everything
is imported and it can be closed.
The import includes: the Cargo workspace (15 crates under
crates/), the Helmchart (
deploy/helm/scg/), e2e examples (deploy/examples/), docs (docs/),the vendored
spark.connect.*protos (proto/), and the full README. Everyimported source file carries the Apache license header; the vendored protos
retain their upstream ASF headers.
Split plan
The import lands as the following small, bottom-up PRs. Each keeps
maingreenunder the full CI matrix (
cargo fmt --all --check,cargo clippy --workspace --all-targets -D warnings,cargo build --workspace,cargo test --workspace)and appends its crate(s) to the workspace
memberslist. This reference PR isrebased after each one merges.
genprotoroutingconfigauthobservabilityaudit+ratelimittenantstore-memory+pool-staticstore-redis+healthcheckpool-k8sproxy(src + tests + examples)gatewaybinaryconfig.example.yaml, full README,docs/,deploy/,test/Dependency layers:
genproto,routing,config,auth,observability,ratelimit,auditare leaves;tenant→auth, andstore-memory/store-redis/pool-static/pool-k8s/healthcheck→routing;proxydepends on 7 of those (and its tests/examples pull in 4 more, which iswhy PRs 8–9 precede 11);
gatewaydepends on all.Why are the changes needed?
Implements the reference gateway from the approved SPIP (SPARK-58455), moving it
into the
apache/spark-connect-gatewaysubproject repo.Does this PR introduce any user-facing change?
No.
How was this patch tested?
cargo check --workspace --all-targetsandcargo fmt --checkpass locally;helm lintpasses on the chart. Per-crate tests come in with the split PRs.Was this patch authored or co-authored using generative AI tooling?
Yes, co-authored with Claude Code.