SaurabhChawla100 commented on a change in pull request #32558:
URL: https://github.com/apache/spark/pull/32558#discussion_r633059806



##########
File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/csv/CSVInferSchemaSuite.scala
##########
@@ -192,4 +192,13 @@ class CSVInferSchemaSuite extends SparkFunSuite with 
SQLHelper {
     Seq("en-US").foreach(checkDecimalInfer(_, StringType))
     Seq("ko-KR", "ru-RU", "de-DE").foreach(checkDecimalInfer(_, DecimalType(7, 
0)))
   }
+
+  test("SPARK-34953 - DateType should be inferred when user defined format are 
provided") {
+    val options = new CSVOptions(Map("dateFormat" -> "dd-MM-yyyy",

Review comment:
       Yes this works with default date patter which is 'yyyy-MM-dd', If we 
don't specify in the option dateFormat option it will check with the default 
value of dateFormat.
   
   `2,23232,hello,2016-11-11`
   
   ```
   val p =  spark.read.format("csv").option("header", 
"false").option("delimiter", ",").option("inferSchema", 
"true").load("/testDir/test.csv")
   
   p.schema
   res0: org.apache.spark.sql.types.StructType = 
StructType(StructField(_c0,IntegerType,true), 
StructField(_c1,IntegerType,true), StructField(_c2,StringType,true), 
StructField(_c3,DateType,true))
   ```
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to