Github user uncleGen commented on a diff in the pull request:
https://github.com/apache/spark/pull/17202#discussion_r104899893
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala ---
@@ -576,6 +576,11 @@ class Dataset[T] private[sql](
val parsedDelay =
Option(CalendarInterval.fromString("interval " + delayThreshold))
.getOrElse(throw new AnalysisException(s"Unable to parse time
delay '$delayThreshold'"))
+ val delayMs = {
+ val millisPerMonth = CalendarInterval.MICROS_PER_DAY / 1000 * 31
+ parsedDelay.milliseconds + parsedDelay.months * millisPerMonth
+ }
+ assert(delayMs >= 0, s"delay threshold should not be a negative time:
$delayThreshold")
--- End diff --
@srowen Thanks for you review!
> Why compute all this -- don't you just mean to assert about
delayThreshold?
I do mean to check the `delayThreshold`. `delayThreshold` is converted from
`String` to `CalendarInterval`. `CalendarInterval` divides the `delayThreshold`
into two parts, i.e. month (contain year and month) and microseconds of rest.
(https://github.com/apache/spark/blob/master/common/unsafe/src/main/java/org/apache/spark/unsafe/types/CalendarInterval.java#L86)
(https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/EventTimeWatermarkExec.scala#L87)
> this derived value can only be negative if the input is right?
Sorry, I dont get what you mean.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]