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
43288732
Commit
43288732
authored
12 years ago
by
Stephen Haberman
Browse files
Options
Downloads
Patches
Plain Diff
Add assertion about dependencies.
parent
c34b8ad2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/src/main/scala/spark/PairRDDFunctions.scala
+1
-1
1 addition, 1 deletion
core/src/main/scala/spark/PairRDDFunctions.scala
core/src/test/scala/spark/ShuffleSuite.scala
+13
-3
13 additions, 3 deletions
core/src/test/scala/spark/ShuffleSuite.scala
with
14 additions
and
4 deletions
core/src/main/scala/spark/PairRDDFunctions.scala
+
1
−
1
View file @
43288732
...
...
@@ -62,7 +62,7 @@ class PairRDDFunctions[K: ClassManifest, V: ClassManifest](
}
val
aggregator
=
new
Aggregator
[
K
,
V
,
C
](
createCombiner
,
mergeValue
,
mergeCombiners
)
if
(
Option
(
partitioner
)
==
self
.
partitioner
)
{
if
(
self
.
partitioner
==
Some
(
partitioner
)
)
{
self
.
mapPartitions
(
aggregator
.
combineValuesByKey
(
_
),
true
)
}
else
if
(
mapSideCombine
)
{
val
mapSideCombined
=
self
.
mapPartitions
(
aggregator
.
combineValuesByKey
(
_
),
true
)
...
...
This diff is collapsed.
Click to expand it.
core/src/test/scala/spark/ShuffleSuite.scala
+
13
−
3
View file @
43288732
package
spark
import
scala.collection.mutable.ArrayBuffer
import
scala.collection.mutable.HashSet
import
org.scalatest.FunSuite
import
org.scalatest.matchers.ShouldMatchers
...
...
@@ -105,11 +106,20 @@ class ShuffleSuite extends FunSuite with ShouldMatchers with LocalSparkContext {
def
numPartitions
=
2
def
getPartition
(
key
:
Any
)
=
key
.
asInstanceOf
[
Int
]
}
val
pairs
=
rddToPairRDDFunctions
(
sc
.
parallelize
(
Array
((
1
,
1
),
(
1
,
2
),
(
1
,
1
),
(
0
,
1
)))).
partitionBy
(
p
)
val
sums
=
pairs
.
reduceByKey
(
p
,
_
+
_
)
println
(
sums
.
toDebugString
)
val
pairs
=
sc
.
parallelize
(
Array
((
1
,
1
),
(
1
,
2
),
(
1
,
1
),
(
0
,
1
))).
partitionBy
(
p
)
val
sums
=
pairs
.
reduceByKey
(
_
+
_
)
assert
(
sums
.
collect
().
toSet
===
Set
((
1
,
4
),
(
0
,
1
)))
assert
(
sums
.
partitioner
===
Some
(
p
))
// count the dependencies to make sure there is only 1 ShuffledRDD
val
deps
=
new
HashSet
[
RDD
[
_
]]()
def
visit
(
r
:
RDD
[
_
])
{
for
(
dep
<-
r
.
dependencies
)
{
deps
+=
dep
.
rdd
visit
(
dep
.
rdd
)
}
}
visit
(
sums
)
assert
(
deps
.
size
===
2
)
// ShuffledRDD, ParallelCollection
}
test
(
"join"
)
{
...
...
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