I am using Spark 2.2.0
I read the csv file as follows:
val dataFrame = spark.read.option("inferSchema", "true") .option("header", true) .option("dateFormat", "yyyyMMdd") .csv(pathToCSVFile)
There is one date column in this file, and for this column all entries have a value equal to 20171001 .
The problem is that the spark infers that the type of this column is integer , not date . When I "inferSchema" parameter, the type of this column is string .
There are no null or malformed string in this file.
What is the reason / solution to this problem?
source share