sarutak commented on a change in pull request #33456:
URL: https://github.com/apache/spark/pull/33456#discussion_r674347354
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala
##########
@@ -739,13 +740,23 @@ class Dataset[T] private[sql](
// We only accept an existing column name, not a derived column here as a
watermark that is
// defined on a derived column cannot referenced elsewhere in the plan.
def withWatermark(eventTime: String, delayThreshold: String): Dataset[T] =
withTypedPlan {
- val parsedDelay =
- try {
+ val parsedDelay = try {
+ if (delayThreshold.toLowerCase(Locale.ROOT).startsWith("interval")) {
+ CatalystSqlParser.parseExpression(delayThreshold) match {
+ case Literal(months: Int, _: YearMonthIntervalType) =>
+ new CalendarInterval(months, 0, 0)
+ case Literal(micros: Long, _: DayTimeIntervalType) =>
+ val days = micros / DateTimeConstants.MICROS_PER_DAY
+ val restMicros = micros % DateTimeConstants.MICROS_PER_DAY
Review comment:
Ah, we don't need to normalize. 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]