GitHub user dongjoon-hyun opened a pull request:
https://github.com/apache/spark/pull/13282
[SPARK-15512][CORE] repartition(0) should raise IllegalArgumentException
## What changes were proposed in this pull request?
Previously, SPARK-8893 added the constraints on positive number of
partitions for repartition/coalesce operations in general. This PR adds one
missing part for that and adds explicit two testcases.
**Before**
```scala
scala> sc.parallelize(1 to 5).coalesce(0).collect()
java.lang.IllegalArgumentException: requirement failed: Number of
partitions (0) must be positive.
...
scala> sc.parallelize(1 to 5).repartition(0).collect()
res1: Array[Int] = Array() // empty
```
**After**
```scala
scala> sc.parallelize(1 to 5).coalesce(0).collect()
java.lang.IllegalArgumentException: requirement failed: Number of
partitions (0) must be positive.
...
scala> sc.parallelize(1 to 5).repartition(0).collect()
java.lang.IllegalArgumentException: requirement failed: Number of
partitions (0) must be positive.
...
```
## How was this patch tested?
Pass the Jenkins tests with new testcases.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/dongjoon-hyun/spark SPARK-15512
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/13282.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #13282
----
commit 6848004a457eefbe6c5b25f67889ed53ae1cb036
Author: Dongjoon Hyun <[email protected]>
Date: 2016-05-24T21:48:32Z
[SPARK-15512][CORE] repartition(0) should raise IllegalArgumentException.
----
---
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]