Repository navigation
[SPARK-62503][CONNECT][PYTHON] Delegate standard ALS operations to Rust - #1007
Closed
zhengruifeng wants to merge 1 commit into
Closed
zhengruifeng wants to merge 1 commit into
zhengruifeng wants to merge 1 commit into
Conversation
Co-authored-by: Isaac <no-reply@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Make
from pyspark.ml.recommendation import ALS, ALSModeluse the Rust client for fit, transform, rank, factor tables, recommendations and persistence. Python setters update the native parameters immediately, including both block counts set bysetNumBlocks. The compatibility import aliases the same classes.The Rust APIs and PyO3 now share the relation builder for factor tables and all four recommendation methods. A lazy result retains both the fitted model and any models used by its subset DataFrame. Python subclasses can still override
_fit,_create_modeland_copyValues. ALS and FPGrowth share the code that hands a fitted model reference to a custom factory.The standard module loads its PySpark definitions from the byte-identical Spark 4.3.0 file at
python/pyspark/ml/_upstream/recommendation.py.Why are the changes needed?
ALS was already available in Rust, but standard Python callers still used upstream Python code to build the requests. Routing the standard import through Rust lets the upstream PySpark ALS tests exercise the implementation used by Rust callers. SPARK-62503
Does this PR introduce any user-facing change?
The public Python signatures, import paths and saved-model format are preserved. This change adds no Python dependency.
How was this patch tested?
ALS(75) andALSModel(40). Ran the standard and broader offline ML suites, Rust library and live ALS tests, and type checks. Compiled all Rust integration tests with and withoutwasm-udf. Checked formatting, Clippy, Ruff, generated stubs and vendored source.Was this patch authored or co-authored using generative AI tooling?
Generated-by: OpenAI Codex (GPT-6)
This pull request and its description were written by Isaac.