title: Getting data from HDFS using Sparkstreaming
body: <p>I am trying to read data from HDFS using spark streaming.
  Below is my code. </p>
  
  <pre><code>import org.apache.spark.SparkConf
  import org.apache.spark.streaming.{Seconds, StreamingContext}
  import org.apache.hadoop.fs._
  import org.apache.hadoop.io.{LongWritable, Text}
  import org.apache.hadoop.mapreduce.lib.input.TextInputFormat
  
  val sparkConf = new SparkConf()
  val ssc = new StreamingContext(sparkConf, Seconds(10))
  
  val directory ="hdfs://pc-XXXX:9000/hdfs/watchdirectory/"
  val lines=ssc.fileStream[LongWritable, Text, TextInputFormat](directory, (t:Path) =&gt; true, true).map(_._2.toString)
  lines.count()
  lines.print()
  ssc.start
  ssc.awaitTermination()
  </code></pre>
  
  <p>The code runs but it does not read any data from HDFS. 
  After every 10 seconds I get a blank line.</p>
  
  <p>I have gone through the document for fileStream and I know that I have move the file to the watch directory. 
  But it doesn't work for me. 
  I have also tried with textFileStream but no luck.</p>
  
  <p>I am using spark 2.0.0 built with Scala 2.11.8</p>
  
  <p>Any suggestions please.</p>