Github user srowen commented on a diff in the pull request: https://github.com/apache/spark/pull/14731#discussion_r95058521 --- Diff: docs/streaming-programming-guide.md --- @@ -630,35 +630,106 @@ which creates a DStream from text data received over a TCP socket connection. Besides sockets, the StreamingContext API provides methods for creating DStreams from files as input sources. -- **File Streams:** For reading data from files on any file system compatible with the HDFS API (that is, HDFS, S3, NFS, etc.), a DStream can be created as: +#### File Streams +{:.no_toc} + +For reading data from files on any file system compatible with the HDFS API (that is, HDFS, S3, NFS, etc.), a DStream can be created as +via `StreamingContext.fileStream[KeyClass, ValueClass, InputFormatClass]`. + +File streams do not require running a receiver, hence does not require allocating cores. - <div class="codetabs"> - <div data-lang="scala" markdown="1"> - streamingContext.fileStream[KeyClass, ValueClass, InputFormatClass](dataDirectory) - </div> - <div data-lang="java" markdown="1"> - streamingContext.fileStream<KeyClass, ValueClass, InputFormatClass>(dataDirectory); - </div> - <div data-lang="python" markdown="1"> - streamingContext.textFileStream(dataDirectory) - </div> - </div> +For simple text files, the easiest method is `StreamingContext.textFileStream(dataDirectory)`. - Spark Streaming will monitor the directory `dataDirectory` and process any files created in that directory (files written in nested directories not supported). Note that +<div class="codetabs"> +<div data-lang="scala" markdown="1"> - + The files must have the same data format. - + The files must be created in the `dataDirectory` by atomically *moving* or *renaming* them into - the data directory. - + Once moved, the files must not be changed. So if the files are being continuously appended, the new data will not be read. +{% highlight scala %} +streamingContext.fileStream[KeyClass, ValueClass, InputFormatClass](dataDirectory) +{% endhighlight %} +For text files --- End diff -- Space before, and colon at the end of aline?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org