You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Andreas (JIRA)" <ji...@apache.org> on 2015/08/07 22:03:46 UTC
[jira] [Reopened] (SPARK-9746) PairRDDFunctions.countByKey:
values/counts always 1
[ https://issues.apache.org/jira/browse/SPARK-9746?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas reopened SPARK-9746:
----------------------------
Sorry, but I don't agree.
cntxt..parallelize(List (("a", 1), ("a", 2))).groupBy(_._1).countByKey()
returns 'Map(a -> 1)' but should in my opinion return 'Map(a -> 2)'
If the values (counts) are irrelevant then why this function is called *count*ByKey and why does it return a Map instead of a Set?
The current implementation has no added value compared to 'pairRDD.keys.collect().toSet'
cntxt.paralize
> PairRDDFunctions.countByKey: values/counts always 1
> ---------------------------------------------------
>
> Key: SPARK-9746
> URL: https://issues.apache.org/jira/browse/SPARK-9746
> Project: Spark
> Issue Type: Bug
> Components: Spark Core
> Affects Versions: 1.4.0
> Reporter: Andreas
>
> org.apache.spark.rdd.PairRDDFunctionscountByKey(): Map[K, Long] = self.withScope {
> self.mapValues(_ => 1L).reduceByKey(_ + _).collect().toMap
> }
> obviously always returns count 1 for each key.
> If I understand the docs correctly I would expect this implementation:
> self.mapValues(_.size).reduceByKey(_ + _).collect().toMap
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org