Description
Spark 2.4.5:
scala> val ds = Seq("{'d': '-141704'}").toDS ds: org.apache.spark.sql.Dataset[String] = [value: string] scala> val json = spark.read.schema("d date").json(ds) json: org.apache.spark.sql.DataFrame = [d: date] scala> json.show +----------+ | d| +----------+ |1582-01-01| +----------+
Spark 3.1.0-SNAPSHOT:
scala> val ds = Seq("{'d': '-141704'}").toDS ds: org.apache.spark.sql.Dataset[String] = [value: string] scala> val json = spark.read.schema("d date").json(ds) json: org.apache.spark.sql.DataFrame = [d: date] scala> json.show +----------+ | d| +----------+ |1582-01-11| +----------+