viirya commented on PR #474: URL: https://github.com/apache/spark-connect-rust/pull/474#issuecomment-6957675732
Thanks for putting this together, and for offering to split it. Before going into the code, I'd like to settle the direction, since that decides how it should be split. **What problem does this solve, and for whom?** The description presents this as a prototype for exploring the embedding boundary. It doesn't name a user problem it fixes. Spark is still the engine and the JVM is still the host; Rust only replaces the gRPC/session/operation layer of the existing JVM Connect server, which isn't usually the bottleneck. Could you add the concrete use case and goal? **The measured benefit doesn't justify the size yet.** In the PR's own benchmark at `dce536e8`: - Config Get improves from 0.36 ms to 0.115 ms, but it's sub-millisecond either way. - Query workloads are roughly at parity (0.84–1.07). - Arrow result delivery, the hot path where a native frontend would be expected to help, is 33–40% slower, partly because partitions are fetched one at a time. Only the unmerged overlap experiment reaches 0.93–0.96. That experiment didn't pass its own acceptance criteria and showed more full-GC pauses. So the result so far is a server with a smaller feature set than the JVM one (subset of RPCs, no auth/TLS/streaming) that is slower on the main data path. **Does this belong in this repository?** This repo is the Rust Connect client and the PySpark drop-in. The JVM engine adapter depends on Spark internals (`SessionHolder`, `SparkConnectPlanner`, `ArrowConverters`). It was validated against a 4.2.0 snapshot, while the repo tracks the 4.3.0 protocol, and full acceptance needed a locally patched `ArrowConverters`. Code that has to change in lockstep with Spark internals seems a better fit for apache/spark's connect server module, or a separate repository, than for the client repo. It also adds a second implementation of server-side security behavior (config redaction, UDF guards, READ restrictions) that has to follow the JVM server. The first review here already found three bypasses of that kind. **Cost to the client project.** `native-server.yml` triggers on `crates/spark-connect/**`, `Cargo.toml` and `Cargo.lock`, so most client PRs would run the four-platform native build and the pinned Spark assembly job. The native license fingerprint hashes all of `Cargo.lock`, so an unrelated lockfile change fails native CI until about 4k generated lines are regenerated. **Most of the complexity comes from the JNI boundary itself.** Cleanup lanes, same-thread detach retries, tombstones, ownership retained after failed cleanup, and the "restart the JVM to recover" failure modes all exist because Rust owns Spark resources across JNI. Most of the correctness findings in the first review were in this layer. Possible paths, depending on the goal: - If the goal is to discuss the boundary, a design doc or SPIP on dev@ with this PR kept as a draft or reference branch seems better than merging to master. - If the goal is to reuse the Rust protocol stack for other engines, the frontend crate with the `Engine` trait and mock-engine protocol tests (a few thousand lines, without JNI, C, Java, packaging or license tooling) could be reviewed on its own. The JVM engine could then live where Spark's internals do. Have you also looked at existing Rust Spark Connect servers such as Sail, and how this would relate to them? - If the goal is Connect server performance, it may be more direct to profile and improve `SparkConnectService` in Spark itself. The JVM server is currently ahead on Arrow delivery. Once the direction is agreed, the split can follow from it, and the CI trigger scope and license fingerprint can be narrowed as part of that. -- 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]
