-
- Downloads
Merge pull request #106 from pwendell/master
Add a `repartition` operator. This patch adds an operator called repartition with more straightforward semantics than the current `coalesce` operator. There are a few use cases where this operator is useful: 1. If a user wants to increase the number of partitions in the RDD. This is more common now with streaming. E.g. a user is ingesting data on one node but they want to add more partitions to ensure parallelism of subsequent operations across threads or the cluster. Right now they have to call rdd.coalesce(numSplits, shuffle=true) - that's super confusing. 2. If a user has input data where the number of partitions is not known. E.g. > sc.textFile("some file").coalesce(50).... This is both vague semantically (am I growing or shrinking this RDD) but also, may not work correctly if the base RDD has fewer than 50 partitions. The new operator forces shuffles every time, so it will always produce exactly the number of new partitions. It also throws an exception rather than silently not-working if a bad input is passed. I am currently adding streaming tests (requires refactoring some of the test suite to allow testing at partition granularity), so this is not ready for merge yet. But feedback is welcome.
No related branches found
No related tags found
Showing
- core/src/main/scala/org/apache/spark/rdd/RDD.scala 13 additions, 0 deletionscore/src/main/scala/org/apache/spark/rdd/RDD.scala
- core/src/test/scala/org/apache/spark/rdd/RDDSuite.scala 20 additions, 0 deletionscore/src/test/scala/org/apache/spark/rdd/RDDSuite.scala
- docs/streaming-programming-guide.md 4 additions, 0 deletionsdocs/streaming-programming-guide.md
- streaming/src/main/scala/org/apache/spark/streaming/DStream.scala 7 additions, 0 deletions...g/src/main/scala/org/apache/spark/streaming/DStream.scala
- streaming/src/test/java/org/apache/spark/streaming/JavaTestUtils.scala 1 addition, 2 deletions.../test/java/org/apache/spark/streaming/JavaTestUtils.scala
- streaming/src/test/scala/org/apache/spark/streaming/BasicOperationsSuite.scala 38 additions, 0 deletions...ala/org/apache/spark/streaming/BasicOperationsSuite.scala
- streaming/src/test/scala/org/apache/spark/streaming/CheckpointSuite.scala 2 additions, 2 deletions...st/scala/org/apache/spark/streaming/CheckpointSuite.scala
- streaming/src/test/scala/org/apache/spark/streaming/TestSuiteBase.scala 55 additions, 6 deletions...test/scala/org/apache/spark/streaming/TestSuiteBase.scala
Loading
Please register or sign in to comment