Daniel Darabos created SPARK-8893:
-------------------------------------

             Summary: 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(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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to