uros-b commented on code in PR #56634:
URL: https://github.com/apache/spark/pull/56634#discussion_r3447607550


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv/CSVInferSchema.scala:
##########
@@ -194,12 +201,20 @@ class CSVInferSchema(val options: CSVOptions) extends 
Serializable {
     if ((allCatch opt field.toDouble).isDefined || isInfOrNan(field)) {
       DoubleType
     } else if (options.preferDate) {
-      tryParseDate(field)
+      tryParseTime(field)
     } else {
       tryParseTimestampNTZ(field)
     }
   }
 
+  private def tryParseTime(field: String): DataType = {
+    if (isTimeTypeEnabled && (allCatch opt 
timeFormatter.parse(field)).isDefined) {
+      TimeType(TimeType.MICROS_PRECISION)

Review Comment:
   e.g. let's use `TimeType.DEFAULT_PRECISION` here to avoid hard-coding yet 
another "MICROS" occurrence



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to