You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Daniel Darabos (JIRA)" <ji...@apache.org> on 2015/07/08 12:51:04 UTC

[jira] [Updated] (SPARK-8893) Require positive partition counts in RDD.repartition

     [ https://issues.apache.org/jira/browse/SPARK-8893?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Darabos updated SPARK-8893:
----------------------------------
    Description: 
What does {{sc.parallelize(1 to 3).repartition(p).collect}} return? I would expect {{Array(1, 2, 3)}} regardless of {{p}}. But if {{p}} < 1, it returns {{Array()}}. I think instead it should throw an {{IllegalArgumentException}}.

I think the case is pretty clear for {{p}} < 0. But the behavior for {{p}} = 0 is also error prone. In fact that's how I found this strange behavior. I used {{rdd.repartition(a/b)}} with positive {{a}} and {{b}}, but {{a/b}} was rounded down to zero and the results surprised me. I'd prefer an exception instead of unexpected (corrupt) results.

I'm happy to send a pull request for this.

  was:
What does {{sc.parallelize(1 to 3).repartition(x).collect}} return? I would expect {{Array(1, 2, 3)}} regardless of {{x}}. But if {{x}} < 1, it returns {{Array()}}. I think instead it should throw an {{IllegalArgumentException}}.

I think the case is pretty clear for {{x}} < 0. But the behavior for {{x}} = 0 is also error prone. In fact that's how I found this strange behavior. I used {{rdd.repartition(a/b)}} with positive {{a}} and {{b}}, but {{a/b}} was rounded down to zero and the results surprised me. I'd prefer an exception instead of unexpected (corrupt) results.

I'm happy to send a pull request for this.


> Require positive partition counts in RDD.repartition
> ----------------------------------------------------
>
>                 Key: SPARK-8893
>                 URL: https://issues.apache.org/jira/browse/SPARK-8893
>             Project: Spark
>          Issue Type: Improvement
>    Affects Versions: 1.4.0
>            Reporter: Daniel Darabos
>            Priority: Trivial
>
> What does {{sc.parallelize(1 to 3).repartition(p).collect}} return? I would expect {{Array(1, 2, 3)}} regardless of {{p}}. But if {{p}} < 1, it returns {{Array()}}. I think instead it should throw an {{IllegalArgumentException}}.
> I think the case is pretty clear for {{p}} < 0. But the behavior for {{p}} = 0 is also error prone. In fact that's how I found this strange behavior. I used {{rdd.repartition(a/b)}} with positive {{a}} and {{b}}, but {{a/b}} was rounded down to zero and the results surprised me. I'd prefer an exception instead of unexpected (corrupt) results.
> I'm happy to send a pull request for this.



--
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