Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5442#discussion_r28571272
  
    --- Diff: docs/programming-guide.md ---
    @@ -576,6 +660,34 @@ before the `reduce`, which would cause `lineLengths` 
to be saved in memory after
     
     </div>
     
    +<div data-lang="r" markdown="1">
    +
    +To illustrate RDD basics, consider the simple program below:
    +
    +{% highlight r %}
    +lines <- textFile(sc, "data.txt")
    +lineLengths <- map(lines, length)
    +totalLength <- reduce(lineLengths, "+")
    +{% endhighlight %}
    +
    +The first line defines a base RDD from an external file. This dataset is 
not loaded in memory or
    +otherwise acted on: `lines` is merely a pointer to the file.
    +The second line defines `lineLengths` as the result of a `map` 
transformation. Again, `lineLengths`
    +is *not* immediately computed, due to laziness.
    +Finally, we run `reduce`, which is an action. At this point Spark breaks 
the computation into tasks
    +to run on separate machines, and each machine runs both its part of the 
map and a local reduction,
    +returning only its answer to the driver program.
    +
    +If we also wanted to use `lineLengths` again later, we could add:
    +
    +{% highlight r %}
    +persist(lineLengths)
    --- End diff --
    
    Added a default value for `newLevel` of `persist`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to