title: How to replace null NAN or Infinite values to default value in Spark Scala
body: <p>I'm reading in csvs into Spark and I'm setting the schema to all DecimalType(10,0) columns.  When I query the data, I get the following error:</p>
  
  <pre><code>NumberFormatException: Infinite or NaN
  </code></pre>
  
  <p>If I have NaN/null/infinite values in my dataframe, I would like to set them to 0.  How do I do this?  This is how I'm attempting to load the data:</p>
  
  <pre><code>var cases = spark.read.option("header",false).
  option("nanValue","0").
  option("nullValue","0").
  option("positiveInf","0").
  option("negativeInf","0").
  schema(schema).
  csv(...
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>