title: Skipping rows with missing fields while loading a text file into a Spark Context
body: <p>I need to load a tab delimited file into Spark Context. However some of the fields are missing values, and I need to filter out those rows. I am using the following code. However if the field is completely missing (e.g. one less tab in the row) this code throws an exception. What is a better way to achieve this?</p>
  
  <pre><code>val RDD = sc.textFile("file.txt").map(_.split("\t"))
  .filter(_(0).nonEmpty)
  .filter(_(1).nonEmpty)
  .filter(_(2).nonEmpty)
  .filter(_(3).nonEmpty)
  .filter(_(4).nonEmpty)
  .filter(_(5).nonEmpty)
  </code></pre>