HyukjinKwon edited a comment on issue #23202: [SPARK-26248][SQL] Infer date 
type from CSV
URL: https://github.com/apache/spark/pull/23202#issuecomment-447699150
 
 
   It works for default values but don't work when, for instance, other 
patterns are set.
   
   For instnace:
   
   
   ```scala
   Seq("2010_10_10").toDF.write.text("/tmp/bar")
   
   spark.read.option("inferSchema", "true")
     .option("header", "false")
     .option("timestampFormat", "yyyy_MM_dd")
     .csv("/tmp/foo").printSchema()
   ```
   
   ```
   root
    |-- _c0: date (nullable = true)
   ```
   
   ```scala
   Seq("2010-10-10").toDF.write.text("/tmp/foo")
   
   spark.read.option("inferSchema", "true")
     .option("header", "false")
     .option("timestampFormat", "yyyy-MM-dd")
     .csv("/tmp/foo").printSchema()
   ```
   
   ```
   root
    |-- _c0: timestamp (nullable = true)
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to