File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -2610,7 +2610,9 @@ abstract class JsonSuite extends QueryTest with SharedSparkSession with TestJson
26102610 }
26112611
26122612 test(" inferring timestamp type" ) {
2613- def schemaOf (jsons : String * ): StructType = spark.read.json(jsons.toDS).schema
2613+ def schemaOf (jsons : String * ): StructType = {
2614+ spark.read.option(" inferTimestamp" , true ).json(jsons.toDS).schema
2615+ }
26142616
26152617 assert(schemaOf(
26162618 """ {"a":"2018-12-17T10:11:12.123-01:00"}""" ,
@@ -2633,6 +2635,7 @@ abstract class JsonSuite extends QueryTest with SharedSparkSession with TestJson
26332635 val timestampsWithFormatPath = s " ${dir.getCanonicalPath}/timestampsWithFormat.json "
26342636 val timestampsWithFormat = spark.read
26352637 .option(" timestampFormat" , " dd/MM/yyyy HH:mm" )
2638+ .option(" inferTimestamp" , true )
26362639 .json(datesRecords)
26372640 assert(timestampsWithFormat.schema === customSchema)
26382641
@@ -2645,6 +2648,7 @@ abstract class JsonSuite extends QueryTest with SharedSparkSession with TestJson
26452648 val readBack = spark.read
26462649 .option(" timestampFormat" , " yyyy-MM-dd HH:mm:ss" )
26472650 .option(DateTimeUtils .TIMEZONE_OPTION , " UTC" )
2651+ .option(" inferTimestamp" , true )
26482652 .json(timestampsWithFormatPath)
26492653
26502654 assert(readBack.schema === customSchema)
You can’t perform that action at this time.
0 commit comments