Skip to content

Commit ed7682e

Browse files
committed
Update based on Yong-Siang Shih's errate report
1 parent 50d8530 commit ed7682e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/test/scala/com/high-performance-spark-examples/goldilocks/EvaluationTests.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,20 @@ class EvaluationTests extends FunSuite with SharedSparkContext {
7777

7878
// tag::TwoActions[]
7979
val sorted = rddA.sortByKey()
80-
val count = sorted.count()
80+
val count = sorted.count() // sorted Action 1
8181
val sample: Long = count / 10
82-
sorted.take(sample.toInt)
82+
val sampled = sorted.take(sample.toInt) // sorted Action 2
8383
// end::TwoActions[]
8484
}
8585

8686
test( "Two actions with caching "){
8787
val rddA: RDD[(Double, Int)] = sc.parallelize(keyValuePairs)
8888
// tag::TwoActionsCache[]
8989
val sorted = rddA.sortByKey()
90-
val count = sorted.count()
90+
sorted.persist()
91+
val count = sorted.count() // sorted Action 1
9192
val sample: Long = count / 10
92-
rddA.persist()
93-
sorted.take(sample.toInt)
93+
val sampled = sorted.take(sample.toInt) // sorted Action 2
9494
// end::TwoActionsCache[]
9595
}
9696

0 commit comments

Comments
 (0)