Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/20787#discussion_r175985253
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
---
@@ -1115,13 +1115,17 @@ case class AddMonths(startDate: Expression,
numMonths: Expression)
override def prettyName: String = "add_months"
}
-
/**
- * 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, returns an integer (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) - Returns number of months
between `timestamp1` and `timestamp2`. Positive if `timestamp1` is later than
`timestamp2`",
--- End diff --
You could do either
```scala
@ExpressionDescription(
usage = """
_FUNC_(timestamp1, timestamp2) - blablabla
blabla
blabla
""",
...
```
Let's add the description here too.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]