Re: Why we get 0 when the key is null?
"null" is a valid value in an RDD, so it has to be partition-able. On Fri, Sep 16, 2016 at 2:26 AM, WangJianfei wrote: > When the key is not In the rdd, I can also get an value , I just feel a > little strange. > > > > -- > View this message in context: > http://apache-spark-developers-list.1001551.n3.nabble.com/Why-we-get-0-when-the-key-is-null-tp18952p18955.html > Sent from the Apache Spark Developers List mailing list archive at Nabble.com. > > - > To unsubscribe e-mail: dev-unsubscr...@spark.apache.org > - To unsubscribe e-mail: dev-unsubscr...@spark.apache.org
Re: Why we get 0 when the key is null?
When the key is not In the rdd, I can also get an value , I just feel a little strange. -- View this message in context: http://apache-spark-developers-list.1001551.n3.nabble.com/Why-we-get-0-when-the-key-is-null-tp18952p18955.html Sent from the Apache Spark Developers List mailing list archive at Nabble.com. - To unsubscribe e-mail: dev-unsubscr...@spark.apache.org
Re: Why we get 0 when the key is null?
What else do you expect to get? A non-zero hash value? It can technically be any constant. On Thu, Sep 15, 2016 at 6:15 PM, WangJianfei < wangjianfe...@otcaix.iscas.ac.cn> wrote: > this func is in Partitioner > def getPartition(key: Any): Int = key match { > case null => 0 > //case None => 0 > case _ => Utils.nonNegativeMod(key.hashCode, numPartitions) > } > > > > -- > View this message in context: http://apache-spark- > developers-list.1001551.n3.nabble.com/Why-we-get-0-when- > the-key-is-null-tp18952.html > Sent from the Apache Spark Developers List mailing list archive at > Nabble.com. > > - > To unsubscribe e-mail: dev-unsubscr...@spark.apache.org > >