Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21740#discussion_r202545740
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/recommendation/MatrixFactorizationModel.scala
 ---
    @@ -165,7 +183,7 @@ class MatrixFactorizationModel @Since("0.8.0") (
        */
       @Since("1.1.0")
       def recommendProducts(user: Int, num: Int): Array[Rating] =
    --- End diff --
    
    Returning `Option` could be reasonable, but, I think the caller would end 
up giving up with an exception anyway. There isn't an obviously better thing to 
do.
    
    Exceptions all behave as if unchecked in Scala and don't get expressed in 
method signatures in the byte code. `@throws` is really for Java compatibility 
where it's important for the Java language to express that a checked exception 
is thrown (it makes a compile-time difference in Java).
    
    That's not necessary here, but scaladoc'ing exceptions like this is indeed 
a good idea.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to