Update Spark单机版本环境搭建.md
This commit is contained in:
parent
2253985fee
commit
fe561d883c
@ -107,7 +107,7 @@ hadoop,hadoop
|
|||||||
#### 3. 在scala交互式命令行中执行如下命名
|
#### 3. 在scala交互式命令行中执行如下命名
|
||||||
|
|
||||||
```scala
|
```scala
|
||||||
val file = spark.sparkContext.textFile("file:///usr/app//wc.txt")
|
val file = spark.sparkContext.textFile("file:///usr/app/wc.txt")
|
||||||
val wordCounts = file.flatMap(line => line.split(",")).map((word => (word, 1))).reduceByKey(_ + _)
|
val wordCounts = file.flatMap(line => line.split(",")).map((word => (word, 1))).reduceByKey(_ + _)
|
||||||
wordCounts.collect
|
wordCounts.collect
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user