Github user tdas commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3389#discussion_r20682620
  
    --- Diff: 
streaming/src/main/scala/org/apache/spark/streaming/dstream/FileInputDStream.scala
 ---
    @@ -17,18 +17,50 @@
     
     package org.apache.spark.streaming.dstream
     
    -import java.io.{ObjectInputStream, IOException}
    -import scala.collection.mutable.{HashSet, HashMap}
    +import java.io.{IOException, ObjectInputStream}
    +
    +import scala.Some
    +import scala.collection.mutable
    +import scala.collection.mutable.HashMap
     import scala.reflect.ClassTag
    +
     import org.apache.hadoop.fs.{FileSystem, Path, PathFilter}
    -import org.apache.hadoop.conf.Configuration
     import org.apache.hadoop.mapreduce.{InputFormat => NewInputFormat}
    -import org.apache.spark.rdd.RDD
    -import org.apache.spark.rdd.UnionRDD
    -import org.apache.spark.streaming.{StreamingContext, Time}
    +import org.apache.spark.rdd.{RDD, UnionRDD}
    +import org.apache.spark.streaming._
     import org.apache.spark.util.{TimeStampedHashMap, Utils}
     
    -
    +/**
    + * This class represents an input stream that monitors a Hadoop-compatible 
filesystem for new
    + * files and creates a stream out of them. The way it works as follows.
    + *
    + * This class remembers the information about the files selected in past 
batches for
    + * a certain duration (say, "remember window") as shown in the figure 
below.
    + *
    + *
    + * ignore threshold --->|                              |<--- current batch 
time
    + *                      |<------ remember window ----->|
    + *                      |                              |
    + * 
-------------------------------------------------------------------------------->
 Time
    + *
    + * The trailing end of the window is the "ignore threshold" and all files 
whose mod time
    + * are less than this threshold are assumed to have already been processed 
and therefore ignored.
    + * Files whose mode times are within the "remember window" are checked 
against files that have
    + * already been selected and processed. This is how new files are 
identified in each batch -
    + * files whose mod times are greater than the ignore threshold and have 
not been considered
    + * within the remember window.
    + *
    + * This makes some assumptions from the underlying file system that the 
system is monitoring.
    + * - If a file is to be visible in the file listings, it must be visible 
within a certain
    + *   duration of the mod time of the file. This duration is the "remember 
window", which is set to
    + *   1 minute (see `FileInputDStream.MIN_REMEMBER_DURATION`). Otherwise, 
the file will not be
    + *   selected as the mod time will be less than the ignore threshold when 
it become visible.
    + * - Once a file is visible, the mod time cannot change. If it does due to 
appends, then the
    + *   processing semantics is undefined.
    --- End diff --
    
    Done.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to