Github user bersprockets commented on a diff in the pull request: https://github.com/apache/spark/pull/21169#discussion_r184561518 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala --- @@ -296,10 +296,27 @@ object DateTimeUtils { * `T[h]h:[m]m:[s]s.[ms][ms][ms][us][us][us]+[h]h:[m]m` */ def stringToTimestamp(s: UTF8String): Option[SQLTimestamp] = { - stringToTimestamp(s, defaultTimeZone()) + stringToTimestamp(s, defaultTimeZone(), forceTimezone = false) } def stringToTimestamp(s: UTF8String, timeZone: TimeZone): Option[SQLTimestamp] = { + stringToTimestamp(s, timeZone, forceTimezone = false) + } + + /** + * Converts a timestamp string to microseconds from the unix epoch, w.r.t. the given timezone. + * Returns None if the input string is not a valid timestamp format. + * + * @param s the input timestamp string. + * @param timeZone the timezone of the timestamp string, will be ignored if the timestamp string + * already contains timezone information and `forceTimezone` is false. + * @param forceTimezone if true, force to apply the given timezone to the timestamp string. If the + * timestamp string already contains timezone, return None. + */ + def stringToTimestamp( + s: UTF8String, + timeZone: TimeZone, + forceTimezone: Boolean): Option[SQLTimestamp] = { --- End diff -- It seems more like rejectTzInString or rejectStringTZ.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org