inferSchema in spark-csv package
When CSV is read as dataframe in spark, all the columns are read as string. Is there any way to get the actual type of column? I have the following csv file Name,Department,years_of_experience,DOB Sam,Software,5,1990-10-10 Alex,Data Analytics,3,1992-10-10 I've read the CSV using the below code val df = sqlContext. read. format("com.databricks.spark.csv"). option("header", "true"). option("inferSchema", "true"). load(sampleAdDataS3Location) df.schema All the columns are read as string. I expect the column years_of_experience to be read as int and DOB to be read as date Please note that I've set