cloud-fan commented on a change in pull request #34596:
URL: https://github.com/apache/spark/pull/34596#discussion_r752139512



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/TimestampFormatter.scala
##########
@@ -71,6 +71,19 @@ sealed trait TimestampFormatter extends Serializable {
       s"The method `parseWithoutTimeZone(s: String)` should be implemented in 
the formatter " +
         "of timestamp without time zone")
 
+  /**
+   * Returns true if the parsed timestamp contains the time zone component, 
false otherwise.
+   * Used to determine if the timestamp can be inferred as timestamp without 
time zone.
+   *
+   * @param s - string with timestamp to inspect
+   * @return whether the timestamp string has the time zone component defined.
+   */
+  @throws(classOf[IllegalStateException])
+  def isTimeZoneSet(s: String): Boolean =

Review comment:
       This API looks a bit weird. How about we throw exception in 
`parseWithoutTimeZone` if the input string has timezone?
   
   BTW is it possible to statically fail the ntz formatter creating if the 
pattern string contains timezone? Then we can fail earlier before processing 
data.




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