Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/20787#discussion_r176949408
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
---
@@ -1117,11 +1117,23 @@ case class AddMonths(startDate: Expression,
numMonths: Expression)
}
/**
- * Returns number of months between dates date1 and date2.
+ * Returns number of months between dates `timestamp1` and `timestamp2`.
+ * If `timestamp` is later than `timestamp2`, then the result is positive.
+ * If `timestamp1` and `timestamp2` are on the same day of month, or both
+ * are the last day of month, time of day will be ignored.
+ * Otherwise, the difference is calculated based on 31 days per month, and
+ * rounded to 8 digits.
*/
// scalastyle:off line.size.limit
@ExpressionDescription(
- usage = "_FUNC_(timestamp1, timestamp2) - Returns number of months
between `timestamp1` and `timestamp2`.",
+ usage = """
+ _FUNC_(timestamp1, timestamp2) -
+ If `timestamp` is later than `timestamp2`, then the result is positive.
+ If `timestamp1` and `timestamp2` are on the same day of month, or both
+ are the last day of month, time of day will be ignored.
+ Otherwise, the difference is calculated based on 31 days per month, and
+ rounded to 8 digits.
+ """,
--- End diff --
```scala
usage = """
_FUNC_(timestamp1, timestamp2) - If `timestamp` is later than
`timestamp2`, then the result
is positive. If `timestamp1` and `timestamp2` are on the same day of
month, or both
are the last day of month, time of day will be ignored. Otherwise,
the difference is
calculated based on 31 days per month, and rounded to 8 digits.
""",
```
Let's keep the format consistent.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]