Github user kmadhugit commented on a diff in the pull request:
https://github.com/apache/spark/pull/7020#discussion_r33374945
--- Diff: core/src/main/scala/org/apache/spark/Partitioner.scala ---
@@ -56,7 +56,7 @@ object Partitioner {
*/
def defaultPartitioner(rdd: RDD[_], others: RDD[_]*): Partitioner = {
val bySize = (Seq(rdd) ++ others).sortBy(_.partitions.size).reverse
- for (r <- bySize if r.partitioner.isDefined) {
+ for (r <- bySize if r.partitioner.isDefined && r.partitions.nonEmpty) {
return r.partitioner.get
}
--- End diff --
Thanks for reviewing.. Don't we need to check whether there is an explicit
partitioner is defined by calling "r.partitioner.isDefined" ? If you would
like to avoid "&&" may be I could re-write it like this..
for {
r <- bySize if r.partitioner.isDefined; if r.partitions.nonEmpty
} return r.partitioner.get
Instead of
for (r <- bySize if r.partitioner.isDefined && r.partitions.nonEmpty) {
return r.partitioner.get
}
Thanks,
Madhu.
Mark Hamstra
<notifications@gi
thub.com> To
apache/spark
06/26/2015 10:30 <[email protected]>
AM cc
Madhusudanan
Kandasamy/India/IBM@IBMIN
Please respond to Subject
apache/spark Re: [spark] [SPARK-8048]
<reply Partitionning of an RDD with 0
+007cf30ed13e438c partition shouldn't yield empty
d9171d15679d92925 outer join (#7020)
d115e16f83e2f3b92
cf0000000111a5321
992a170ce01fd211f
@reply.github.com
>
In core/src/main/scala/org/apache/spark/Partitioner.scala:
> @@ -56,7 +56,7 @@ object Partitioner {
> */
> def defaultPartitioner(rdd: RDD[_], others: RDD[_]*): Partitioner = {
> val bySize = (Seq(rdd) ++ others).sortBy(_.partitions.size).reverse
> - for (r <- bySize if r.partitioner.isDefined) {
> + for (r <- bySize if r.partitioner.isDefined &&
r.partitions.nonEmpty) {
> return r.partitioner.get
> }
for {
r <- bySize
partitioner <- r.partitioner if r.partitions.nonEmpty
} return partitioner
â
Reply to this email directly or view it on GitHub.
---
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.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]