title: To count the delimiter between columns in spark RDD or DataFrame and move the rows to separate RDD or dataframes
body: <p>I am new to spark programming and I am loading multiple TSV.gz files into RDD or Dataframes. I want to count the number of tabs between columns once loaded and move the rows of data to separate RDD or dataframes based on the below condition.</p>
  
  <p>Total number of  columns = 996</p>
  
  <pre><code>If the number of tab counts = 995 -&gt; move to another RDD or DF
  If the number of tab counts &lt; 995 -&gt; move to another RDD or DF
  If the number of tab counts &gt; 995 -&gt; move to another RDD or DF
  </code></pre>
  
  <p>I tried the below but was returning Boolean values</p>
  
  <pre><code>val textFile = sc.textFile("/abc/*.tsv.gz")
  textFile.map(line=&gt;line.split("\t"))
  val file1 = textFile.filter(line =&gt; line.contains("\t").count() &gt; 995)
  val file2 = textFile.filter(line =&gt; line.contains("\t").count() &lt; 995)
  </code></pre>
  
  <p>Please let me know if the same can be achieved</p>
  
  <p>Thanks.!</p>