Task not serializable error in Spark Scala
<p>I am trying to read a csv file into an RDD in Spark (Using Scala). I have made a function to first filter data so that it doesn't take the header into consideration.</p>

<pre><code>def isHeader(line: String): Boolean = {
line.contains("id_1")
}
</code></pre>

<p>and then I am running the following command:</p>

<pre><code>val noheader = rawblocks.filter(x =&gt; !isHeader(x))
</code></pre>

<p>The rawblocks RDD reads data from a csv file which is 26MB in size</p>

<p>I am getting Task not serializable error. What can be the solution?</p>