I'm using file as Spark streaming, i want to count the words in the stream, but the application prints nothing, here's my code. I'm using Scala on Cloudera environment
import org.apache.spark.SparkConf
import org.apache.spark.streaming._
import org.apache.spark.streaming.StreamingContext
object TwitterHashtagStreaming {
def main(args: Array[String]) : Unit = {
val conf = new SparkConf().setAppName("TwitterHashtagStreaming").setMaster("local[2]").set("spark.executor.memory","1g");
val streamingC = new StreamingContext(conf,Seconds(5))
val streamLines = streamingC.textFileStream("file:///home/cloudera/Desktop/wordstream")
val words = streamLines.flatMap(_.split(" "))
val counts = words.map(word => (word, 1)).reduceByKey(_ + _)
counts.print()
streamingC.start()
streamingC.awaitTermination()
}
}