title: How to apply strict data type check on Spark Dataframe/Dataset?
body: <p>How to enable strict data type check on spark dataframe/dataset?
  We are receiving many system generated and manual feeds from upstream system for our transformation.
      Ask is to extract feeds and perform strict data type checking against schema before starting transformation
      Can someone suggest how efficiently we can do with Spark 2.0?<br>
      We tried following </p>
  
  <pre><code> 1. User infereSchema = true, while reading file and get generated dataframes schema to validate against expected schema. Normally infereSchema= true is two phase operation, prove costly for give file
   2. Enforcing schema while creating data frame from csv file
  
  
  val df:DataFrame = spark.read.format("csv")
       .schema(readSchemaFromAvroSchemaFile)
       .option("header","true")
       .option("inferSchema","false")
       .csv("CSVFileUri")
  
  
  strict data type check not imposed while writing, 
  it applied only while reading dataframe
  Is it possible to validate without making read call as it could be expensive operation?
  Also in case of double type show some strange behavior 
  if we have avro schema 
  
  
  {
    "namespace":"com.test.schema.validation",
    "name" : "example",
    "type" : "record",
    "fields" [
      {"name":"item_id","type":["null","string"],"default":null},
      {"name":"item_price","type":["null","double"],"default":null}
     ] 
  }
  
  CSV file
  
  item_id|item_price
      1|234.90 
      2|634.90
      3|534.90
      4|233A40.90
      5|233E12
  
  df.show(10)- gives me following
  
      item_id|item_price
      1|234.90 
      2|634.90
      3|534.90
      4|233.90 
      5|2.3E13
  
  Value is Row#4 truncated without any failure so it's hard catch
  Please suggest if you have any efficient way to validate schema
  Have you come across double type value truncation?
  </code></pre>