Github user sergey-rubtsov commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16735#discussion_r98523879
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/csv/CSVInferSchema.scala
 ---
    @@ -140,12 +137,21 @@ private[csv] object CSVInferSchema {
         }
       }
     
    +  private def tryParseDate(field: String, options: CSVOptions): DataType = 
{
    +    // This case infers a custom `dateFormat` is set.
    +    if ((allCatch opt options.dateFormat.parse(field)).isDefined) {
    +      DateType
    +    } else {
    +      tryParseTimestamp(field, options)
    +    }
    +  }
    +
       private def tryParseTimestamp(field: String, options: CSVOptions): 
DataType = {
    -    // This case infers a custom `dataFormat` is set.
    +    // This case infers a custom `timestampFormat` is set.
         if ((allCatch opt options.timestampFormat.parse(field)).isDefined) {
           TimestampType
         } else if ((allCatch opt DateTimeUtils.stringToTime(field)).isDefined) 
{
    -      // We keep this for backwords competibility.
    +      // We keep this for backwards compatibility.
           TimestampType
         } else {
           tryParseBoolean(field, options)
    --- End diff --
    
    okey, I will test it again, thanks


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to