May 2017
Intermediate to advanced
294 pages
7h 33m
English
Let's do the word count, which counts the number of occurrences of each word. In this recipe, we will load data from HDFS:
$ mkdir words
$ echo "to be or not to be" > words/sh.txt
$ hdfs dfs -put words
$ spark-shell
scala> val words = spark.read.textFile("hdfs://localhost:9000/user/hduser/words")
Read now
Unlock full access