dbtsai opened a new pull request, #870: URL: https://github.com/apache/spark-connect-rust/pull/870
### What changes were proposed in this pull request? Part **1/6** of the planned split of [#474](https://github.com/apache/spark-connect-rust/pull/474), tracked by [SPARK-61384](https://issues.apache.org/jira/browse/SPARK-61384). Add an unpublished, opt-in `spark-connect-server` library. An embedding application supplies an `Engine` and a bound TCP listener to `serve_with_engine`; the frontend serves real Spark Connect gRPC requests and delegates planning, execution, analysis and configuration to that engine. - Manage protocol sessions, operation IDs, response framing, backpressure and cancellation on release, disconnect or shutdown. - Validate Arrow schemas, encode record batches, forward eligible IPC unchanged and split oversized batches to fit the 3 MiB ExecutePlan response limit. Enforce consistent physical types and nullability across emitted batches so clients can assemble one Arrow table; metadata may differ. - Add protocol and injected-engine tests, security and API documentation, and focused frontend CI on stable Rust and Rust 1.88.0. ### Why are the changes needed? The combined server change in #474 is difficult to review as one patch. This PR establishes the protocol and engine boundary as an independently buildable foundation. It targets `master` directly and does not depend on the later execution-adapter, JNI, licensing or distribution PRs. ### Does this PR introduce _any_ user-facing change? Yes: an experimental Rust library API is available to applications that provide their own execution engine. Existing client source and default workspace members are unchanged. This extraction is based on `master` at `97427c9d24da70bf070ed487444ab12da0954a9d` and uses its current workspace dependencies and lockfile, adding only the frontend package entry. It does not require the older workspace or Spark assembly used by #474. The library includes no execution backend, query planner or standalone server executable. Test engines select predefined outputs and live only in the test suite; their results establish frontend behavior, not Spark query semantics or server compatibility. No Java/JNI integration or distribution artifacts are included. The supported protocol subset delegates `ExecutePlan`, `AnalyzePlan` and `Config`, and implements operation/session release. Reattachment, artifacts, `Interrupt`, enriched errors, session cloning and status queries return `UNIMPLEMENTED`. The frontend has no authentication, authorization or TLS: use a loopback listener with trusted clients and engine outputs. Active sessions and operations have no admission limit or idle expiry. Engine implementations must honor the documented cancellation and cleanup contract. Mixing unchanged view-typed IPC with materialized split IPC can fail the output-schema consistency check; the README describes this limit. ### How was this patch tested? Completed locally on macOS ARM64: - Rust 1.100.0 and MSRV 1.88.0: all 35 frontend tests passed (8 unit, 12 engine-injection, 10 protocol and 5 schema-consistency tests); strict frontend Clippy passed on both toolchains. - The nested-request test passed with default Prost features and with `prost/no-recursion-limit`, as enabled by other workspace crates. Its original single-mode assertion was confirmed to fail under the latter configuration before the fix. - `cargo fmt --all --check` and `cargo clippy --locked --workspace --all-targets -- -D warnings` passed on Rust 1.100.0. - `cargo test --locked -p apache-spark-connect --release --lib`: 809 tests passed. All client integration tests compiled with and without `wasm-udf`. - Core session and artifact integration tests: 18 passed. - PySpark 4.2.0 source and a PyArrow 26.0.0 probe confirmed mixed physical types/nullability are rejected by table assembly while metadata variation is accepted. Schema tests cover both IPC size transitions and nested List/LargeList/Map view arrays. - Strict rustdoc for the frontend and published Rust crates, generated binary-license freshness and workflow YAML checks passed. Frontend build and test commands are documented in the [frontend README](https://github.com/dbtsai/spark-connect-rust/blob/d5cd54024dcafd7357958403457c77061c90f979/crates/spark-connect-server/README.md). Hosted CI is pending. No real-engine acceptance, Spark execution compatibility or performance result is claimed for this frontend-only extraction. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: OpenAI Codex (version unavailable in this session) This pull request and its description were written by OpenAI Codex. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
