Github user srowen commented on a diff in the pull request: https://github.com/apache/spark/pull/17202#discussion_r104944765 --- 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 -- Sorry that last example didn't make sense, it's not a single number. It just doesn't seem like you need to reproduce this conversion to check what you want to, which is that the two fields aren't negative. `require(parsedDelay.milliseconds >= 0 && parsedDelay.months >= 0)` In fact, I wonder if this should be some kind of method of CalendarInterval, like `isNegative`? it's not that trivial to decide if an interval is negative, and maybe other places do this.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org