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
682b2d93
Commit
682b2d93
authored
12 years ago
by
Matei Zaharia
Browse files
Options
Downloads
Patches
Plain Diff
Added a test for when an RDD only partially fits in memory
parent
dca496bb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/test/scala/spark/DistributedSuite.scala
+18
-2
18 additions, 2 deletions
core/src/test/scala/spark/DistributedSuite.scala
with
18 additions
and
2 deletions
core/src/test/scala/spark/DistributedSuite.scala
+
18
−
2
View file @
682b2d93
...
...
@@ -158,12 +158,28 @@ class DistributedSuite extends FunSuite with ShouldMatchers with BeforeAndAfter
assert
(
data
.
count
()
===
1000
)
}
test
(
"compute without caching w
ith low
memory"
)
{
test
(
"compute without caching w
hen no partitions fit in
memory"
)
{
System
.
setProperty
(
"spark.storage.memoryFraction"
,
"0.0001"
)
sc
=
new
SparkContext
(
clusterUrl
,
"test"
)
val
data
=
sc
.
parallelize
(
1
to
4000000
,
2
).
persist
(
StorageLevel
.
MEMORY_ONLY
)
// data will be 4 million * 4 bytes = 16 MB in size, but our memoryFraction set the cache
// to only 50 KB (0.0001 of 512 MB), so no partitions should fit in memory
val
data
=
sc
.
parallelize
(
1
to
4000000
,
2
).
persist
(
StorageLevel
.
MEMORY_ONLY_SER
)
assert
(
data
.
count
()
===
4000000
)
assert
(
data
.
count
()
===
4000000
)
assert
(
data
.
count
()
===
4000000
)
System
.
clearProperty
(
"spark.storage.memoryFraction"
)
}
test
(
"compute when only some partitions fit in memory"
)
{
System
.
setProperty
(
"spark.storage.memoryFraction"
,
"0.01"
)
sc
=
new
SparkContext
(
clusterUrl
,
"test"
)
// data will be 4 million * 4 bytes = 16 MB in size, but our memoryFraction set the cache
// to only 5 MB (0.01 of 512 MB), so not all of it will fit in memory; we use 20 partitions
// to make sure that *some* of them do fit though
val
data
=
sc
.
parallelize
(
1
to
4000000
,
20
).
persist
(
StorageLevel
.
MEMORY_ONLY_SER
)
assert
(
data
.
count
()
===
4000000
)
assert
(
data
.
count
()
===
4000000
)
assert
(
data
.
count
()
===
4000000
)
System
.
clearProperty
(
"spark.storage.memoryFraction"
)
}
}
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