cloud-fan commented on a change in pull request #32995:
URL: https://github.com/apache/spark/pull/32995#discussion_r655542069
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/TimestampFormatter.scala
##########
@@ -50,9 +51,31 @@ sealed trait TimestampFormatter extends Serializable {
@throws(classOf[DateTimeException])
def parse(s: String): Long
+ /**
+ * Parses a timestamp in a string and converts it to microseconds since Unix
Epoch in local time.
+ *
+ * @param s - string with timestamp to parse
+ * @return microseconds since epoch.
+ * @throws ParseException can be thrown by legacy parser
+ * @throws DateTimeParseException can be thrown by new parser
+ * @throws DateTimeException unable to obtain local date or time
+ * @throws UnsupportedOperationException cannot use legacy formatter for the
parsing
+ */
+ @throws(classOf[ParseException])
+ @throws(classOf[DateTimeParseException])
+ @throws(classOf[DateTimeException])
+ @throws(classOf[UnsupportedOperationException])
+ def parseWithoutTimeZone(s: String): Long =
+ throw QueryExecutionErrors.cannotUseLegacyFormatterForTimestampWithoutTZ();
Review comment:
This is not a user-facing error: we should never hit it. We can just
throw IllegelStateException here and no need to document this with `@throws`
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/TimestampFormatter.scala
##########
@@ -50,9 +51,31 @@ sealed trait TimestampFormatter extends Serializable {
@throws(classOf[DateTimeException])
def parse(s: String): Long
+ /**
+ * Parses a timestamp in a string and converts it to microseconds since Unix
Epoch in local time.
+ *
+ * @param s - string with timestamp to parse
+ * @return microseconds since epoch.
+ * @throws ParseException can be thrown by legacy parser
+ * @throws DateTimeParseException can be thrown by new parser
+ * @throws DateTimeException unable to obtain local date or time
+ * @throws UnsupportedOperationException cannot use legacy formatter for the
parsing
+ */
+ @throws(classOf[ParseException])
+ @throws(classOf[DateTimeParseException])
+ @throws(classOf[DateTimeException])
+ @throws(classOf[UnsupportedOperationException])
+ def parseWithoutTimeZone(s: String): Long =
+ throw QueryExecutionErrors.cannotUseLegacyFormatterForTimestampWithoutTZ();
+
def format(us: Long): String
def format(ts: Timestamp): String
def format(instant: Instant): String
+
+ @throws(classOf[UnsupportedOperationException])
Review comment:
ditto
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]