sadikovi commented on a change in pull request #34596:
URL: https://github.com/apache/spark/pull/34596#discussion_r755539240



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
##########
@@ -442,17 +442,22 @@ object DateTimeUtils {
 
   /**
    * Trims and parses a given UTF8 string to a corresponding [[Long]] value 
which representing the
-   * number of microseconds since the epoch. The result is independent of time 
zones,
-   * which means that zone ID in the input string will be ignored.
+   * number of microseconds since the epoch. The result will be independent of 
time zones.
+   *
+   * If the input string contains a component associated with time zone, the 
method will return
+   * `None` if `ignoreTimeZone` is set to `false`. If `ignoreTimeZone` is set 
to `true`, the method
+   * will simply discard the time zone component. Enable the check to detect 
situations like parsing
+   * a timestamp with time zone as TimestampNTZType.
+   *
    * The return type is [[Option]] in order to distinguish between 0L and 
null. Please
    * refer to `parseTimestampString` for the allowed formats.
    */
-  def stringToTimestampWithoutTimeZone(s: UTF8String): Option[Long] = {
+  def stringToTimestampWithoutTimeZone(s: UTF8String, ignoreTimeZone: 
Boolean): Option[Long] = {

Review comment:
       I understand, but we don't fail if ignoreTimeZone was set to `false`, we 
return an Option instead. I can update in TimestampFormatter but `failOnError` 
in `stringToTimestampWithoutTimeZone` might be a bit misleading. Let me know 
what you think. Thanks.




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