HyukjinKwon opened a new pull request, #450: URL: https://github.com/apache/spark-connect-rust/pull/450
### What changes were proposed in this pull request? [SPARK-61325](https://issues.apache.org/jira/browse/SPARK-61325): `scripts/run_official_tests.py` sets `PYTHONHASHSEED=0` for its test processes, in both modes (through the Rust transport and against the drop-in). ### Why are the changes needed? The default seed of a `pyspark.ml` estimator is `hash(type(self).__name__)` (`HasSeed`), and Python randomizes the hash of a str per process. So the random k-fold split of `CrossValidator` differs per run. In about 7% of the runs, the official `test_crossvalidator_with_random_forest_classifier` (`pyspark/ml/tests/connect/test_parity_tuning.py`: 6 rows, 3 folds, no seed) trains a fold on label 0 only, and the evaluation fails with `requirement failed: rawPredictionCol vectors must have length=2, but got 1`. It failed the drop-in job of master at 094f47b6 ([run](https://github.com/apache/spark-connect-rust/actions/runs/42717540506)). This comes from the test's randomness, not from a client: - The `rand(seed)` split of the test's 6 rows, as `CrossValidator._kFold` computes it, trains a fold on label 0 only for 22 of the seeds 0 to 299 (19, 66, 97, 102, ...). - `CrossValidator(..., seed=19)` and `seed=66` on the test's data fail with that error on official PySpark 4.3.0 and on the drop-in alike, and seed 18 passes on both. With `PYTHONHASHSEED=0`, the default seed of `CrossValidator` is `-3087263388934076904` in every run, and that split passes on both clients. ### Does this PR introduce _any_ user-facing change? No, CI only. ### How was this patch tested? Against a local Spark 4.3.0 Connect server: - `run_official_tests.py --dropin --only pyspark.ml.tests.connect.test_parity_tuning`, three runs: 7 passed each. - `run_official_tests.py --only pyspark.ml.tests.connect.test_parity_tuning` (through the transport), two runs: 7 passed each. - The `CrossValidator` seed checks above, on official PySpark 4.3.0 and on the drop-in. - `python -m unittest discover -s scripts/tests`: OK. It merges cleanly with #443, which edits the same function. ### 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. -- 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]
