zhengruifeng commented on a change in pull request #26990: 
[SPARK-18409][ML][FOLLOWUP] LSH approxNearestNeighbors optimization
URL: https://github.com/apache/spark/pull/26990#discussion_r361033143
 
 

 ##########
 File path: mllib/src/main/scala/org/apache/spark/ml/feature/LSH.scala
 ##########
 @@ -112,9 +113,7 @@ private[ml] abstract class LSHModel[T <: LSHModel[T]]
       numNearestNeighbors: Int,
       singleProbe: Boolean,
       distCol: String): Dataset[_] = {
-    val count = dataset.count()
-    require(numNearestNeighbors > 0 && numNearestNeighbors <= count, "The 
number of" +
-      " nearest neighbors cannot be less than 1 or greater than the number of 
elements in dataset")
+    require(numNearestNeighbors > 0, "The number of nearest neighbors cannot 
be less than 1")
 
 Review comment:
   As discussed in https://github.com/apache/spark/pull/26415,
   
   "@param numNearestNeighbors The maximum number of nearest neighbors."
   It implies it could return fewer items.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to