File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/test/scala/com/high-performance-spark-examples/goldilocks Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments