Github user srowen commented on the pull request:
https://github.com/apache/spark/pull/876#issuecomment-44169636
Yes I had a similar question. This would calculate different partitions for
the same key when called from different places and times, and I imagine that
causes several methods to fail. For example, what about joining two RDDs both
using this partitioner (and with multiple partitions) -- anything that creates
a shuffle dependency among two pair RDDs. Surely the different instances of the
depended-upon RDD's partitioner will return different partitions for keys and
get the answer wrong?
I'm thinking of any time the partitioner instance is copied around -- it
will copy state but then its state, which is essential to its answers, varies.
Maybe someone more knowledgeable than I can confirm an easy way to test this,
or that I really misunderstand and this never happens.
`HashPartitioner` expects to give fairly balanced partitions already,
unless the value's hash function is bad. That is better fixed in the hash
function itself.
I had thought the problem was more often in pair RDDs where one key has a
lot of values, and operations that group by key create imbalanced partitions?
That's not the question here right, that wouldn't be helped by this.
---
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.
---