Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs525-sp18-g07
spark
Commits
2fda84fe
Commit
2fda84fe
authored
11 years ago
by
Patrick Wendell
Browse files
Options
Downloads
Patches
Plain Diff
Always use a shuffle
parent
08c1a42d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/main/scala/org/apache/spark/rdd/RDD.scala
+7
-15
7 additions, 15 deletions
core/src/main/scala/org/apache/spark/rdd/RDD.scala
with
7 additions
and
15 deletions
core/src/main/scala/org/apache/spark/rdd/RDD.scala
+
7
−
15
View file @
2fda84fe
...
@@ -268,22 +268,14 @@ abstract class RDD[T: ClassManifest](
...
@@ -268,22 +268,14 @@ abstract class RDD[T: ClassManifest](
/**
/**
* Return a new RDD that has exactly numPartitions partitions.
* Return a new RDD that has exactly numPartitions partitions.
*
*
* Used to increase or decrease the level of parallelism in this RDD. By default, this will use
* Used to increase or decrease the level of parallelism in this RDD. This will use
* a shuffle to redistribute data. If you are shrinking the RDD into fewer partitions, you can
* a shuffle to redistribute data.
* set skipShuffle = false to avoid a shuffle. Skipping shuffles is not supported when
* increasing the number of partitions.
*
*
* Similar to `coalesce`, but shuffles by default, allowing you to call this safely even
* If you are decreasing the number of partitions in this RDD, consider using `coalesce`,
* if you don't know the number of partitions.
* which can avoid performing a shuffle.
*/
*/
def
repartition
(
numPartitions
:
Int
,
skipShuffle
:
Boolean
=
false
)
:
RDD
[
T
]
=
{
def
repartition
(
numPartitions
:
Int
)
:
RDD
[
T
]
=
{
if
(
skipShuffle
&&
numPartitions
>
this
.
partitions
.
size
)
{
coalesce
(
numPartitions
,
true
)
val
msg
=
"repartition must grow %s from %s to %s partitions, cannot skip shuffle."
.
format
(
this
.
name
,
this
.
partitions
.
size
,
numPartitions
)
throw
new
IllegalArgumentException
(
msg
)
}
coalesce
(
numPartitions
,
!
skipShuffle
)
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment