zhengruifeng opened a new pull request, #516: URL: https://github.com/apache/spark-connect-rust/pull/516
### What changes were proposed in this pull request? Mark the PyO3 `Column` class as `frozen`. `Column` has no mutable Rust methods, setters, or `PyRefMut` use. The existing `dict` and `weakref` support remains enabled, so Python dynamic attributes and weak references continue to work. ### Why are the changes needed? PyO3 can access a frozen class payload without runtime mutable-borrow checks. `Column` is used throughout Python expression construction, so declaring its existing immutability invariant reduces overhead on direct payload access and extraction. A Python 3.13 release-mode microbenchmark used 300,000 calls per case, median times from 9 and 11 rounds, fresh processes, and both baseline/frozen execution orders. Results were: | Operation | Baseline | Frozen | Speedup | | --- | ---: | ---: | ---: | | Rust helper extracting `Column` | 127-131 ns | 120-124 ns | 5.4-5.9% | | `column._expr` getter | 108.5-110.2 ns | 104.0-104.4 ns | 4.1-5.3% | | `repr(column)` | 132.6-137.5 ns | 128.4-129.3 ns | 2.4-6.7% | Higher-level expression-building operations were dominated by allocation and expression construction and did not show a stable end-to-end difference in this microbenchmark. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? - `cargo fmt --all --check` - `cargo build -p pyspark-rs --release` - `cargo test -p apache-spark-connect --release --lib` (602 passed) - `cargo test -p apache-spark-connect --release --no-run` - `cargo test -p apache-spark-connect --release --features wasm-udf --no-run` - Offline Python suites: 3,118 passed, 8 skipped, 14 subtests passed - Verified Python dynamic attributes and weak references on `Column` ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Codex (GPT-5) This pull request and its description were written by Isaac. -- 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]
