You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/10/25 15:29:35 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #26177: [SPARK-29520][SS] Fix checks of negative intervals

cloud-fan commented on a change in pull request #26177: [SPARK-29520][SS] Fix checks of negative intervals
URL: https://github.com/apache/spark/pull/26177#discussion_r339112319
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala
 ##########
 @@ -119,4 +121,32 @@ object IntervalUtils {
       case _: IllegalArgumentException => null
     }
   }
+
+  /**
+   * Gets interval duration
+   *
+   * @param cal - the interval to get duration
+   * @param targetUnit - time units of the result
+   * @param daysPerMonth - the number of days per one month
+   * @return duration in the specified time units
+   */
+  def getDuration(
+      cal: CalendarInterval,
+      targetUnit: TimeUnit,
+      daysPerMonth: Int = 31): Long = {
 
 Review comment:
   Are there any other places we need to get a duration of interval except for stream watermark? If not I think it's simpler to call it `getDurationForWaterwark`, and explain why we pick 1 month = 31 days, according to https://github.com/apache/spark/pull/16304#discussion_r92753590

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org