Skip to content

Commit c6bf156

Browse files
author
John O'Leary
committed
[SPARK-22107] Change as to alias in python quickstart
1 parent 3e6a714 commit c6bf156

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/quick-start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ This first maps a line to an integer value and aliases it as "numWords", creatin
153153
One common data flow pattern is MapReduce, as popularized by Hadoop. Spark can implement MapReduce flows easily:
154154

155155
{% highlight python %}
156-
>>> wordCounts = textFile.select(explode(split(textFile.value, "\s+")).as("word")).groupBy("word").count()
156+
>>> wordCounts = textFile.select(explode(split(textFile.value, "\s+")).alias("word")).groupBy("word").count()
157157
{% endhighlight %}
158158

159159
Here, we use the `explode` function in `select`, to transfrom a Dataset of lines to a Dataset of words, and then combine `groupBy` and `count` to compute the per-word counts in the file as a DataFrame of 2 columns: "word" and "count". To collect the word counts in our shell, we can call `collect`:

0 commit comments

Comments
 (0)