diff options
author | Sean R. Owen <srowen@apache.org> | 2015-03-02 22:06:52 +0000 |
---|---|---|
committer | Sean R. Owen <srowen@apache.org> | 2015-03-02 22:06:52 +0000 |
commit | fb97e0ec8a74c26b98a3627668443b1263f9ee14 (patch) | |
tree | 5d14f23979ef628b849fa7680d183476e8b805b3 /site | |
parent | 1ebfe3555cc40800978b77ca79375ec253c96864 (diff) | |
download | spark-website-fb97e0ec8a74c26b98a3627668443b1263f9ee14.tar.gz spark-website-fb97e0ec8a74c26b98a3627668443b1263f9ee14.tar.bz2 spark-website-fb97e0ec8a74c26b98a3627668443b1263f9ee14.zip |
SPARK-4992 Improve var naming in Python example; change other var names to match
Diffstat (limited to 'site')
-rw-r--r-- | site/examples.html | 24 | ||||
-rw-r--r-- | site/index.html | 8 |
2 files changed, 16 insertions, 16 deletions
diff --git a/site/examples.html b/site/examples.html index 5b7eab2e2..01ba0ec87 100644 --- a/site/examples.html +++ b/site/examples.html @@ -187,8 +187,8 @@ previous ones, and <em>actions</em>, which kick off a job to execute on a cluste <div class="tab-content"> <div class="tab-pane tab-pane-python active"> <div class="code code-tab"> - file = spark.textFile(<span class="string">"hdfs://..."</span>)<br /> - errors = file.<span class="sparkop">filter</span>(<span class="closure">lambda line: "ERROR" in line</span>)<br /> + text_file = spark.textFile(<span class="string">"hdfs://..."</span>)<br /> + errors = text_file.<span class="sparkop">filter</span>(<span class="closure">lambda line: "ERROR" in line</span>)<br /> <span class="comment"># Count all the errors</span><br /> errors.<span class="sparkop">count</span>()<br /> <span class="comment"># Count errors mentioning MySQL</span><br /> @@ -199,8 +199,8 @@ previous ones, and <em>actions</em>, which kick off a job to execute on a cluste </div> <div class="tab-pane tab-pane-scala"> <div class="code code-tab"> - <span class="keyword">val</span> file = spark.textFile(<span class="string">"hdfs://..."</span>)<br /> - <span class="keyword">val</span> errors = file.<span class="sparkop">filter</span>(<span class="closure">line => line.contains("ERROR")</span>)<br /> + <span class="keyword">val</span> textFile = spark.textFile(<span class="string">"hdfs://..."</span>)<br /> + <span class="keyword">val</span> errors = textFile.<span class="sparkop">filter</span>(<span class="closure">line => line.contains("ERROR")</span>)<br /> <span class="comment">// Count all the errors</span><br /> errors.<span class="sparkop">count</span>()<br /> <span class="comment">// Count errors mentioning MySQL</span><br /> @@ -211,8 +211,8 @@ previous ones, and <em>actions</em>, which kick off a job to execute on a cluste </div> <div class="tab-pane tab-pane-java"> <div class="code code-tab"> - JavaRDD<String> file = spark.textFile(<span class="string">"hdfs://..."</span>);<br /> - JavaRDD<String> errors = file.<span class="sparkop">filter</span>(<span class="closure">new Function<String, Boolean>() {<br /> + JavaRDD<String> textFile = spark.textFile(<span class="string">"hdfs://..."</span>);<br /> + JavaRDD<String> errors = textFile.<span class="sparkop">filter</span>(<span class="closure">new Function<String, Boolean>() {<br /> public Boolean call(String s) { return s.contains("ERROR"); }<br /> }</span>);<br /> <span class="comment">// Count all the errors</span><br /> @@ -272,8 +272,8 @@ previous ones, and <em>actions</em>, which kick off a job to execute on a cluste <div class="tab-content"> <div class="tab-pane tab-pane-python active"> <div class="code code-tab"> - file = spark.textFile(<span class="string">"hdfs://..."</span>)<br /> - counts = file.<span class="sparkop">flatMap</span>(<span class="closure">lambda line: line.split(" ")</span>) \<br /> + text_file = spark.textFile(<span class="string">"hdfs://..."</span>)<br /> + counts = text_file.<span class="sparkop">flatMap</span>(<span class="closure">lambda line: line.split(" ")</span>) \<br /> .<span class="sparkop">map</span>(<span class="closure">lambda word: (word, 1)</span>) \<br /> .<span class="sparkop">reduceByKey</span>(<span class="closure">lambda a, b: a + b</span>)<br /> counts.<span class="sparkop">saveAsTextFile</span>(<span class="string">"hdfs://..."</span>) @@ -281,8 +281,8 @@ previous ones, and <em>actions</em>, which kick off a job to execute on a cluste </div> <div class="tab-pane tab-pane-scala"> <div class="code code-tab"> - <span class="keyword">val</span> file = spark.textFile(<span class="string">"hdfs://..."</span>)<br /> - <span class="keyword">val</span> counts = file.<span class="sparkop">flatMap</span>(<span class="closure">line => line.split(" ")</span>)<br /> + <span class="keyword">val</span> textFile = spark.textFile(<span class="string">"hdfs://..."</span>)<br /> + <span class="keyword">val</span> counts = textFile.<span class="sparkop">flatMap</span>(<span class="closure">line => line.split(" ")</span>)<br /> .<span class="sparkop">map</span>(<span class="closure">word => (word, 1)</span>)<br /> .<span class="sparkop">reduceByKey</span>(<span class="closure">_ + _</span>)<br /> counts.<span class="sparkop">saveAsTextFile</span>(<span class="string">"hdfs://..."</span>) @@ -290,8 +290,8 @@ previous ones, and <em>actions</em>, which kick off a job to execute on a cluste </div> <div class="tab-pane tab-pane-java"> <div class="code code-tab"> - JavaRDD<String> file = spark.textFile(<span class="string">"hdfs://..."</span>);<br /> - JavaRDD<String> words = file.<span class="sparkop">flatMap</span>(<span class="closure">new FlatMapFunction<String, String>() {<br /> + JavaRDD<String> textFile = spark.textFile(<span class="string">"hdfs://..."</span>);<br /> + JavaRDD<String> words = textFile.<span class="sparkop">flatMap</span>(<span class="closure">new FlatMapFunction<String, String>() {<br /> public Iterable<String> call(String s) { return Arrays.asList(s.split(" ")); }<br /> }</span>);<br /> JavaPairRDD<String, Integer> pairs = words.<span class="sparkop">mapToPair</span>(<span class="closure">new PairFunction<String, String, Integer>() {<br /> diff --git a/site/index.html b/site/index.html index 8af128452..c3360efd5 100644 --- a/site/index.html +++ b/site/index.html @@ -212,9 +212,9 @@ <div class="col-md-5 col-sm-5 col-padded-top col-center"> <div style="text-align: left; display: inline-block;"> <div class="code"> - file = spark.textFile(<span class="string">"hdfs://..."</span>)<br /> + text_file = spark.textFile(<span class="string">"hdfs://..."</span>)<br /> <br /> - file.<span class="sparkop">flatMap</span>(<span class="closure">lambda line: line.split()</span>)<br /> + text_file.<span class="sparkop">flatMap</span>(<span class="closure">lambda line: line.split()</span>)<br /> .<span class="sparkop">map</span>(<span class="closure">lambda word: (word, 1)</span>)<br /> .<span class="sparkop">reduceByKey</span>(<span class="closure">lambda a, b: a+b</span>) </div> @@ -222,9 +222,9 @@ </div> <!-- <div class="code" style="margin-top: 20px; text-align: left; display: inline-block;"> - file = spark.textFile(<span class="string">"hdfs://..."</span>)<br/> + text_file = spark.textFile(<span class="string">"hdfs://..."</span>)<br/> <br/> - file.<span class="sparkop">filter</span>(<span class="closure">lambda line: "ERROR" in line</span>)<br/> + text_file.<span class="sparkop">filter</span>(<span class="closure">lambda line: "ERROR" in line</span>)<br/> .<span class="sparkop">count</span>() </div> --> |