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

    https://github.com/apache/spark/pull/407#discussion_r11795323
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/recommendation/ALS.scala ---
    @@ -167,11 +177,23 @@ class ALS private (
           this.numBlocks
         }
     
    -    val partitioner = new HashPartitioner(numBlocks)
    +    val defaultPartitioner = new Partitioner {
    +      val numPartitions = numBlocks
    +
    +      def getPartition(x: Any): Int = x match {
    +        case null => 0
    --- End diff --
    
    We know we are partitioning integers, so we don't need pattern matching. 
This function implementation can be changed to
    
    ~~~
    Utils.nonNegativeMod(byteswap32(x.asInstanceOf[Int]), numPartitions)
    ~~~


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to