1. 程式人生 > >spark源碼 hashpartitioner

spark源碼 hashpartitioner

spark源碼 class bsp spark code ash clas log shc

def nonNegativeMod(x: Int, mod: Int): Int = {
      val rawMod = x % mod
      rawMod + (if (rawMod < 0) mod else 0)
  def getPartition(key: Any): Int = key match {
    case null => 0
    case _ => Utils.nonNegativeMod(key.hashCode, numPartitions)
  }

spark源碼 hashpartitioner