title: Spark read with filter
body: <p>I am working with the Spark Java API.  I am trying to read a file from a directory and filter some lines out.  My code looks something like this:</p>
  
  <pre><code>final JavaSparkContext jsc = new JavaSparkContext(sparkConf);
  JavaRDD&lt;String&gt; textFile = jsc .textFile("/path/to/some/file");
  
  //First Read....
  JavaRDD&lt;Msg&gt; parsedMessages = textFile.map(....);
  
  //Then Filter
  JavaRDD&lt;Msg&gt; queryResults = parsedMessages.filter(....)
  </code></pre>
  
  <p>Is there a way to combine the read and filter operation into the same operation?  Something like read with filter?  I have a very specific requirement where I have to query a very large data set, but I get a relatively small result set back.  I then have to do a series of transformations and calculations on that filtered data.  I don't want to read the whole data set into memory and then filter it out.  I don't have that much memory.  What I would like to do instead is to filter it at read time so only the lines matching some Regex would be read in.  Is this possible to do with Spark?</p>