GitHub user MLnick opened a pull request: https://github.com/apache/spark/pull/12762
[SPARK-14891][ML] Add schema validation for ALS This PR adds schema validation to `ml`'s ALS and ALSModel. Currently, no schema validation was performed as `transformSchema` was never called in `ALS.fit` or `ALSModel.transform`. Furthermore, due to no schema validation, if users passed in Long (or Float etc) ids, they would be silently cast to Int with no warning or error thrown. With this PR, ALS now supports all numeric types for `user`, `item`, and `rating` columns. The rating column is cast to `Float` and the user and item cols are cast to `Int` (as is the case currently) - however for user/item, the cast throws an error if the value is outside integer range. Behavior for rating col is unchanged (as it is not an issue). ## How was this patch tested? New test cases in `ALSSuite`. You can merge this pull request into a Git repository by running: $ git pull https://github.com/MLnick/spark SPARK-14891-als-validate-schema Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/12762.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #12762 ---- commit c21d5a0afd756a023c8f1e85018f9438cdff3ad6 Author: Nick Pentreath <ni...@za.ibm.com> Date: 2016-04-28T11:49:16Z Intial work commit e5860cd08a18b93abecd9bbc786316517629ec91 Author: Nick Pentreath <ni...@za.ibm.com> Date: 2016-04-28T13:47:45Z Improve tests and add transform test cases + small cleanup commit c5f3e1a095dd80add219848f92d3c2b7667fbaa3 Author: Nick Pentreath <ni...@za.ibm.com> Date: 2016-04-28T14:12:54Z revert small erroneous addition commit 73ea0b62f1c0ae6a9897ec83f5c8dfedea86f3f9 Author: Nick Pentreath <ni...@za.ibm.com> Date: 2016-04-28T18:47:41Z user/item col param docs ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org