@@ -127,7 +127,11 @@ object IntervalUtils {
127127 *
128128 * @param cal - the interval to get duration
129129 * @param targetUnit - time units of the result
130- * @param daysPerMonth - the number of days per one month
130+ * @param daysPerMonth - the number of days per one month. The default value is 31 days
131+ * per month. This value was taken as the default because it is used
132+ * in Structured Streaming for watermark calculations. Having 31 days
133+ * per month, we can guarantee that events are not dropped before
134+ * the end of any month (February with 29 days or January with 31 days).
131135 * @return duration in the specified time units
132136 */
133137 def getDuration (
@@ -142,8 +146,12 @@ object IntervalUtils {
142146 /**
143147 * Checks the interval is negative
144148 *
145- * @param cal - the checked interval
146- * @param daysPerMonth - the number of days per one month
149+ * @param cal - the checked interval
150+ * @param daysPerMonth - the number of days per one month. The default value is 31 days
151+ * per month. This value was taken as the default because it is used
152+ * in Structured Streaming for watermark calculations. Having 31 days
153+ * per month, we can guarantee that events are not dropped before
154+ * the end of any month (February with 29 days or January with 31 days).
147155 * @return true if duration of the given interval is less than 0 otherwise false
148156 */
149157 def isNegative (cal : CalendarInterval , daysPerMonth : Int = 31 ): Boolean = {
0 commit comments