Hi,

I tried to modify NetworkWordCount example in order to save the output to a
file.

In NetworkWordCount.scala I replaced the line

wordCounts.print()
with
wordCounts.saveAsTextFile("/home/bart/rest_services/output.txt")

When I ran sbt/sbt package it returned the following error:

[error]
/home/bart/spark-1.1.0/examples/src/main/scala/org/apache/spark/examples/streaming/NetworkWordCountModified.scala:57:
value saveAsTextFile is not a member of
org.apache.spark.streaming.dstream.DStream[(String, Int)]
[error]
wordCounts.saveAsTextFile("/home/bart/rest_services/output.txt")
[error]                    ^
[error] one error found
[error] (examples/compile:compile) Compilation failed
[error] Total time: 5 s, completed Nov 14, 2014 9:38:53 PM

Does anyone know why this error occurs?
Is there any other way to save the results to a text file?

Regards,

Niko

Reply via email to