<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to use saveAsTextFiles in spark streaming in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39399#M24428</link>
    <description>&lt;P&gt;It does not work,&lt;/P&gt;&lt;P&gt;what is the problem?&lt;/P&gt;&lt;P&gt;Here are my console:&lt;/P&gt;&lt;PRE&gt;Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
16/04/06 12:44:42 INFO SparkContext: Running Spark version 1.5.0
16/04/06 12:44:46 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
16/04/06 12:44:48 INFO SecurityManager: Changing view acls to: root
16/04/06 12:44:48 INFO SecurityManager: Changing modify acls to: root
16/04/06 12:44:48 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(root); users with modify permissions: Set(root)
16/04/06 12:45:00 INFO Slf4jLogger: Slf4jLogger started
16/04/06 12:45:00 INFO Remoting: Starting remoting
16/04/06 12:45:04 INFO Remoting: Remoting started; listening on addresses :[akka.tcp://sparkDriver@192.168.1.31:38825]
16/04/06 12:45:04 INFO Utils: Successfully started service 'sparkDriver' on port 38825.
16/04/06 12:45:04 INFO SparkEnv: Registering MapOutputTracker
16/04/06 12:45:04 INFO SparkEnv: Registering BlockManagerMaster
16/04/06 12:45:05 INFO DiskBlockManager: Created local directory at /tmp/blockmgr-1b896884-d84a-4c39-b9dd-93decdb6ee0b
16/04/06 12:45:05 INFO MemoryStore: MemoryStore started with capacity 1027.3 MB
16/04/06 12:45:06 INFO HttpFileServer: HTTP File server directory is /tmp/spark-14a1c553-e160-4b93-8822-3b943e27edd1/httpd-849fa48d-e2de-46de-845a-a68a02f76b94
16/04/06 12:45:06 INFO HttpServer: Starting HTTP Server
16/04/06 12:45:08 INFO Utils: Successfully started service 'HTTP file server' on port 50992.
16/04/06 12:45:08 INFO SparkEnv: Registering OutputCommitCoordinator
16/04/06 12:45:11 INFO Utils: Successfully started service 'SparkUI' on port 4040.
16/04/06 12:45:11 INFO SparkUI: Started SparkUI at http://192.168.1.31:4040
16/04/06 12:45:12 WARN MetricsSystem: Using default name DAGScheduler for source because spark.app.id is not set.
16/04/06 12:45:12 INFO Executor: Starting executor ID driver on host localhost
16/04/06 12:45:15 INFO Utils: Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 42498.
16/04/06 12:45:15 INFO NettyBlockTransferService: Server created on 42498
16/04/06 12:45:15 INFO BlockManagerMaster: Trying to register BlockManager
16/04/06 12:45:15 INFO BlockManagerMasterEndpoint: Registering block manager localhost:42498 with 1027.3 MB RAM, BlockManagerId(driver, localhost, 42498)
16/04/06 12:45:15 INFO BlockManagerMaster: Registered BlockManager
16/04/06 12:45:18 WARN StreamingContext: spark.master should be set as local[n], n &amp;gt; 1 in local mode if you have receivers to get data, otherwise Spark jobs will not get resources to process the received data.
16/04/06 12:45:22 INFO FileInputDStream: Duration for remembering RDDs set to 60000 ms for org.apache.spark.streaming.dstream.FileInputDStream@11fb9657
16/04/06 12:45:23 INFO SparkUI: Stopped Spark web UI at http://192.168.1.31:4040
16/04/06 12:45:23 INFO DAGScheduler: Stopping DAGScheduler
16/04/06 12:45:23 INFO MapOutputTrackerMasterEndpoint: MapOutputTrackerMasterEndpoint stopped!
16/04/06 12:45:23 INFO MemoryStore: MemoryStore cleared
16/04/06 12:45:23 INFO BlockManager: BlockManager stopped
16/04/06 12:45:23 INFO BlockManagerMaster: BlockManagerMaster stopped
16/04/06 12:45:23 INFO OutputCommitCoordinator$OutputCommitCoordinatorEndpoint: OutputCommitCoordinator stopped!
16/04/06 12:45:23 INFO RemoteActorRefProvider$RemotingTerminator: Shutting down remote daemon.
16/04/06 12:45:23 INFO RemoteActorRefProvider$RemotingTerminator: Remote daemon shut down; proceeding with flushing remote transports.
16/04/06 12:45:23 INFO SparkContext: Successfully stopped SparkContext
16/04/06 12:45:23 INFO ShutdownHookManager: Shutdown hook called
16/04/06 12:45:23 INFO ShutdownHookManager: Deleting directory /tmp/spark-14a1c553-e160-4b93-8822-3b943e27edd1&lt;/PRE&gt;&lt;P&gt;No creation of the file,&amp;nbsp;nothing happens.&lt;/P&gt;&lt;P&gt;what's wrong?&lt;/P&gt;</description>
    <pubDate>Wed, 06 Apr 2016 11:51:11 GMT</pubDate>
    <dc:creator>ghandrisaleh</dc:creator>
    <dc:date>2016-04-06T11:51:11Z</dc:date>
    <item>
      <title>How to use saveAsTextFiles in spark streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39376#M24424</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It is simple to display the result in RDD, for example:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;val sc = new SparkContext(conf)
val textFile = sc.textFile("/root/file/test")
val apps = textFile.map (line =&amp;gt; line.split(";")(0))
    .map(p=&amp;gt;(p,1)) // convert to countable tuples
    .reduceByKey(_+_) // count keys
    .collect() // collect the result
    apps.foreach(println)&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;And I have the result in my console.And if I want to save the output to a file I do:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;apps.saveAsTextFiles("/root/file/file1")&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;But how I can do it now with DStream,this is my code:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;val sc = new SparkContext(conf)
val ssc = new StreamingContext(sc, Seconds(10))
  val file = ssc.textFileStream("/root/file/test")
  var test = file.map(x =&amp;gt; (x.split(" ")(0)+";"+x.split(" ")(1), 1)).reduceByKey((x,y) =&amp;gt; x+y)
  test.saveAsTextFiles("/root/file/file1")
    sc.stop()  
  }
}&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;But it doesn't work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Any help please !!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 10:12:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39376#M24424</guid>
      <dc:creator>ghandrisaleh</dc:creator>
      <dc:date>2022-09-16T10:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to use saveAsTextFiles in spark streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39390#M24425</link>
      <description>&lt;P&gt;You have a handy method bundled with Spark "foreachRDD":&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;  val file = ssc.textFileStream("/root/file/test")&lt;BR /&gt;  file.foreachRDD(t=&amp;gt; {&lt;BR /&gt;           var test=t.map() //DO the map stuff here&lt;BR /&gt;       &lt;BR /&gt;           test.saveAsTextFiles("/root/file/file1")&lt;BR /&gt;&lt;BR /&gt;         })&lt;BR /&gt;&lt;BR /&gt;sc.stop()&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 06:51:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39390#M24425</guid>
      <dc:creator>_Umesh</dc:creator>
      <dc:date>2016-04-06T06:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use saveAsTextFiles in spark streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39391#M24426</link>
      <description>&lt;P&gt;I try :&lt;/P&gt;&lt;PRE&gt;val file = ssc.textFileStream("/root/file/test")
  file.foreachRDD(t=&amp;gt; {
           var test = file.map(x =&amp;gt; (x.split(" ")(0)+";"+x.split(" ")(1), 1)).reduceByKey((x,y) =&amp;gt; x+y)       
           test.saveAsTextFiles("/root/file/file1")
         })

sc.stop()&lt;/PRE&gt;&lt;P&gt;But it doesn't work&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 08:22:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39391#M24426</guid>
      <dc:creator>ghandrisaleh</dc:creator>
      <dc:date>2016-04-06T08:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to use saveAsTextFiles in spark streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39396#M24427</link>
      <description>&lt;P&gt;From your code :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;val &lt;/SPAN&gt;textFile = sc.textFileStream(&lt;SPAN&gt;"/root/file/test"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;textFile.foreachRDD(t=&amp;gt; {&lt;BR /&gt;&lt;BR /&gt;  &lt;SPAN&gt;val &lt;/SPAN&gt;test = t.map(x =&amp;gt; (x.split(&lt;SPAN&gt;" "&lt;/SPAN&gt;)(&lt;SPAN&gt;0&lt;/SPAN&gt;)+&lt;SPAN&gt;";"&lt;/SPAN&gt;+x.split(&lt;SPAN&gt;" "&lt;/SPAN&gt;)(&lt;SPAN&gt;1&lt;/SPAN&gt;)&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;)).reduceByKey((x&lt;SPAN&gt;,&lt;/SPAN&gt;y) =&amp;gt; x+y)&lt;BR /&gt;&lt;BR /&gt;  test.saveAsTextFile(&lt;SPAN&gt;"/root/file/file1"&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;})&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mind the &lt;STRONG&gt;t.map( )&lt;/STRONG&gt; not file.map( )&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 10:41:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39396#M24427</guid>
      <dc:creator>_Umesh</dc:creator>
      <dc:date>2016-04-06T10:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to use saveAsTextFiles in spark streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39399#M24428</link>
      <description>&lt;P&gt;It does not work,&lt;/P&gt;&lt;P&gt;what is the problem?&lt;/P&gt;&lt;P&gt;Here are my console:&lt;/P&gt;&lt;PRE&gt;Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
16/04/06 12:44:42 INFO SparkContext: Running Spark version 1.5.0
16/04/06 12:44:46 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
16/04/06 12:44:48 INFO SecurityManager: Changing view acls to: root
16/04/06 12:44:48 INFO SecurityManager: Changing modify acls to: root
16/04/06 12:44:48 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(root); users with modify permissions: Set(root)
16/04/06 12:45:00 INFO Slf4jLogger: Slf4jLogger started
16/04/06 12:45:00 INFO Remoting: Starting remoting
16/04/06 12:45:04 INFO Remoting: Remoting started; listening on addresses :[akka.tcp://sparkDriver@192.168.1.31:38825]
16/04/06 12:45:04 INFO Utils: Successfully started service 'sparkDriver' on port 38825.
16/04/06 12:45:04 INFO SparkEnv: Registering MapOutputTracker
16/04/06 12:45:04 INFO SparkEnv: Registering BlockManagerMaster
16/04/06 12:45:05 INFO DiskBlockManager: Created local directory at /tmp/blockmgr-1b896884-d84a-4c39-b9dd-93decdb6ee0b
16/04/06 12:45:05 INFO MemoryStore: MemoryStore started with capacity 1027.3 MB
16/04/06 12:45:06 INFO HttpFileServer: HTTP File server directory is /tmp/spark-14a1c553-e160-4b93-8822-3b943e27edd1/httpd-849fa48d-e2de-46de-845a-a68a02f76b94
16/04/06 12:45:06 INFO HttpServer: Starting HTTP Server
16/04/06 12:45:08 INFO Utils: Successfully started service 'HTTP file server' on port 50992.
16/04/06 12:45:08 INFO SparkEnv: Registering OutputCommitCoordinator
16/04/06 12:45:11 INFO Utils: Successfully started service 'SparkUI' on port 4040.
16/04/06 12:45:11 INFO SparkUI: Started SparkUI at http://192.168.1.31:4040
16/04/06 12:45:12 WARN MetricsSystem: Using default name DAGScheduler for source because spark.app.id is not set.
16/04/06 12:45:12 INFO Executor: Starting executor ID driver on host localhost
16/04/06 12:45:15 INFO Utils: Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 42498.
16/04/06 12:45:15 INFO NettyBlockTransferService: Server created on 42498
16/04/06 12:45:15 INFO BlockManagerMaster: Trying to register BlockManager
16/04/06 12:45:15 INFO BlockManagerMasterEndpoint: Registering block manager localhost:42498 with 1027.3 MB RAM, BlockManagerId(driver, localhost, 42498)
16/04/06 12:45:15 INFO BlockManagerMaster: Registered BlockManager
16/04/06 12:45:18 WARN StreamingContext: spark.master should be set as local[n], n &amp;gt; 1 in local mode if you have receivers to get data, otherwise Spark jobs will not get resources to process the received data.
16/04/06 12:45:22 INFO FileInputDStream: Duration for remembering RDDs set to 60000 ms for org.apache.spark.streaming.dstream.FileInputDStream@11fb9657
16/04/06 12:45:23 INFO SparkUI: Stopped Spark web UI at http://192.168.1.31:4040
16/04/06 12:45:23 INFO DAGScheduler: Stopping DAGScheduler
16/04/06 12:45:23 INFO MapOutputTrackerMasterEndpoint: MapOutputTrackerMasterEndpoint stopped!
16/04/06 12:45:23 INFO MemoryStore: MemoryStore cleared
16/04/06 12:45:23 INFO BlockManager: BlockManager stopped
16/04/06 12:45:23 INFO BlockManagerMaster: BlockManagerMaster stopped
16/04/06 12:45:23 INFO OutputCommitCoordinator$OutputCommitCoordinatorEndpoint: OutputCommitCoordinator stopped!
16/04/06 12:45:23 INFO RemoteActorRefProvider$RemotingTerminator: Shutting down remote daemon.
16/04/06 12:45:23 INFO RemoteActorRefProvider$RemotingTerminator: Remote daemon shut down; proceeding with flushing remote transports.
16/04/06 12:45:23 INFO SparkContext: Successfully stopped SparkContext
16/04/06 12:45:23 INFO ShutdownHookManager: Shutdown hook called
16/04/06 12:45:23 INFO ShutdownHookManager: Deleting directory /tmp/spark-14a1c553-e160-4b93-8822-3b943e27edd1&lt;/PRE&gt;&lt;P&gt;No creation of the file,&amp;nbsp;nothing happens.&lt;/P&gt;&lt;P&gt;what's wrong?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 11:51:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39399#M24428</guid>
      <dc:creator>ghandrisaleh</dc:creator>
      <dc:date>2016-04-06T11:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use saveAsTextFiles in spark streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39400#M24429</link>
      <description>&lt;P&gt;Seems that there is&amp;nbsp;some glitch in your&amp;nbsp;code. It would&amp;nbsp;be much easy if you could&amp;nbsp;post your code.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 11:55:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39400#M24429</guid>
      <dc:creator>_Umesh</dc:creator>
      <dc:date>2016-04-06T11:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use saveAsTextFiles in spark streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39401#M24430</link>
      <description>&lt;P&gt;this is my code :&lt;/P&gt;&lt;PRE&gt;import org.apache.spark.SparkConf
import org.apache.spark.SparkContext
import org.apache.spark.scheduler.SparkListener
import org.apache.spark.scheduler.SparkListenerStageCompleted
import org.apache.spark.streaming.StreamingContext._ 
import org.apache.spark.streaming.{Seconds, StreamingContext}
object FileCount {
    def main(args: Array[String]) {
    val conf = new SparkConf()
    .setAppName("File Count")
    .setMaster("local")

    val sc = new SparkContext(conf)
    val ssc = new StreamingContext(sc, Seconds(10))
    val file = ssc.textFileStream("/root/file/test/f3")
   file.foreachRDD(t=&amp;gt; {
         val test = t.map(x =&amp;gt; (x.split(" ")(0)+";"+x.split(" ")(1), 1)).reduceByKey((x,y) =&amp;gt; x+y)
         test.saveAsTextFile("/root/file/file1")

})
  sc.stop()  
  }
}&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Apr 2016 11:59:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39401#M24430</guid>
      <dc:creator>ghandrisaleh</dc:creator>
      <dc:date>2016-04-06T11:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use saveAsTextFiles in spark streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39402#M24431</link>
      <description>&lt;P&gt;You need to assign number of threads to spark while running master on local, most obvious choice is 2, 1 to recieve the data and 1 to process them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so the correct code should be :&lt;/P&gt;&lt;PRE&gt;    .setMaster("local[2]")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your file is not too big change to :&lt;/P&gt;&lt;PRE&gt;    val ssc = new StreamingContext(sc, Seconds(1))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have stopped the streaming but forgot to start it:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;   file.foreachRDD(t=&amp;gt; {
         val test = t.map(x =&amp;gt; (x.split(" ")(0)+";"+x.split(" ")(1), 1)).reduceByKey((x,y) =&amp;gt; x+y)
         test.saveAsTextFile("/root/file/file1")

})&lt;BR /&gt;&lt;BR /&gt;sc.start()&lt;BR /&gt;sc.awaitTermination()&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As of now dont use sc.stop()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 12:13:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39402#M24431</guid>
      <dc:creator>_Umesh</dc:creator>
      <dc:date>2016-04-06T12:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use saveAsTextFiles in spark streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39404#M24432</link>
      <description>&lt;P&gt;I try it, and I get :&lt;/P&gt;&lt;PRE&gt;16/04/06 14:09:52 INFO FileInputDStream: Duration for remembering RDDs set to 60000 ms for org.apache.spark.streaming.dstream.FileInputDStream@4bf57335
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.spark.util.ThreadUtils$.runInNewThread$default$2()Z
	at org.apache.spark.streaming.StreamingContext.liftedTree1$1(StreamingContext.scala:606)
	at org.apache.spark.streaming.StreamingContext.start(StreamingContext.scala:600)
	at com.org.file.filecount.FileCount$.main(FileCount.scala:52)
	at com.org.file.filecount.FileCount.main(FileCount.scala)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 13:20:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39404#M24432</guid>
      <dc:creator>ghandrisaleh</dc:creator>
      <dc:date>2016-04-06T13:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to use saveAsTextFiles in spark streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39437#M24433</link>
      <description>&lt;PRE&gt;Exception in thread "main" java.lang.NoSuchMethodError: org.apache.spark.util.ThreadUtils$.runInNewThread$default$2()Z&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Compare your code with below line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    .setMaster("local[2]")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW which version of Spark Streaming you are usning?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2016 08:57:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39437#M24433</guid>
      <dc:creator>_Umesh</dc:creator>
      <dc:date>2016-04-07T08:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to use saveAsTextFiles in spark streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39441#M24434</link>
      <description>&lt;PRE&gt;16/04/06 14:09:52 INFO FileInputDStream: Duration for remembering RDDs set to 60000 ms for org.apache.spark.streaming.dstream.FileInputDStream@4bf57335
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.spark.util.ThreadUtils$.runInNewThread$default$2()Z
	at org.apache.spark.streaming.StreamingContext.liftedTree1$1(StreamingContext.scala:606)
	at org.apache.spark.streaming.StreamingContext.start(StreamingContext.scala:600)
	at com.org.file.filecount.FileCount$.main(FileCount.scala:52)
	at com.org.file.filecount.FileCount.main(FileCount.scala)&lt;/PRE&gt;&lt;P&gt;there's a mismatch in the versions of dependencies and runtime so i do :&lt;/P&gt;&lt;PRE&gt;            &amp;lt;dependency&amp;gt;
		&amp;lt;groupId&amp;gt;org.apache.spark&amp;lt;/groupId&amp;gt;
		&amp;lt;artifactId&amp;gt;spark-core_2.10&amp;lt;/artifactId&amp;gt;
		&amp;lt;version&amp;gt;1.6.1&amp;lt;/version&amp;gt;
	    &amp;lt;/dependency&amp;gt;
	    &amp;lt;dependency&amp;gt;
		&amp;lt;groupId&amp;gt;org.apache.spark&amp;lt;/groupId&amp;gt;
		&amp;lt;artifactId&amp;gt;spark-streaming_2.10&amp;lt;/artifactId&amp;gt;
		&amp;lt;version&amp;gt;1.6.1&amp;lt;/version&amp;gt;
	    &amp;lt;/dependency&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;And i am getting error like as the following :&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;16/04/07 11:23:56 WARN FileInputDStream: Error finding new files
java.io.IOException: Incomplete HDFS URI, no host: "/root/file/test"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2016 10:34:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39441#M24434</guid>
      <dc:creator>ghandrisaleh</dc:creator>
      <dc:date>2016-04-07T10:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to use saveAsTextFiles in spark streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39444#M24435</link>
      <description>&lt;P&gt;I don't know why but I re-run and it works, but I have an empty _success file into the directory file1.&lt;/P&gt;&lt;P&gt;here is the complete code :&lt;/P&gt;&lt;PRE&gt;    def main(args: Array[String]) {
    val conf = new SparkConf()
    .setAppName("File Count")
    .setMaster("local[2]")

    val sc = new SparkContext(conf)
    val ssc = new StreamingContext(sc, Seconds(1))
    val file = ssc.textFileStream("/root/file/test/file")
   file.foreachRDD(t=&amp;gt; {
         val test = t.map(x =&amp;gt; (x.split(" ")(0)+";"+x.split(" ")(1), 1)).reduceByKey((x,y) =&amp;gt; x+y)
         test.saveAsTextFile("/root/file/file1")

})
  ssc.start()
  ssc.awaitTermination()
  }&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Apr 2016 11:13:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39444#M24435</guid>
      <dc:creator>ghandrisaleh</dc:creator>
      <dc:date>2016-04-07T11:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use saveAsTextFiles in spark streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39445#M24436</link>
      <description>&lt;P&gt;Thats because you have no new files arriving in the directory&amp;nbsp;after streaming application starts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can try "cp" to drop files in the directory after starting the streaming application.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2016 11:26:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-use-saveAsTextFiles-in-spark-streaming/m-p/39445#M24436</guid>
      <dc:creator>_Umesh</dc:creator>
      <dc:date>2016-04-07T11:26:42Z</dc:date>
    </item>
  </channel>
</rss>

