HyukjinKwon commented on a change in pull request #25334: 
[SPARK-28598][SQL][WIP] Few date time manipulation functions does not provide 
versions supporting Column as input through the Dataframe API
URL: https://github.com/apache/spark/pull/25334#discussion_r310033036
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/functions.scala
 ##########
 @@ -2590,8 +2590,21 @@ object functions {
    * @group datetime_funcs
    * @since 1.5.0
    */
-  def add_months(startDate: Column, numMonths: Int): Column = withExpr {
-    AddMonths(startDate.expr, Literal(numMonths))
+  def add_months(startDate: Column, numMonths: Int): Column = 
add_months(startDate, lit(numMonths))
+
+  /**
+   * Returns the date that is `numMonths` after `startDate`.
+   *
+   * @param startDate A date, timestamp or string. If a string, the data must 
be in a format that
+   *                  can be cast to a date, such as `yyyy-MM-dd` or 
`yyyy-MM-dd HH:mm:ss.SSSS`
+   * @param numMonths A column of the number of months to add to `startDate`, 
can be negative to
+   *                  subtract months
+   * @return A date, or null if `startDate` was a string that could not be 
cast to a date
+   * @group datetime_funcs
+   * @since 3.0.0
+   */
+  def add_months(startDate: Column, numMonths: Column): Column = withExpr {
 
 Review comment:
   There was some discussion about it. I am sure there are more instances like 
this and we decided to don't add all overridden versions because this functions 
get too long. We already have multiple SQL functions that are not added into 
this file (see the comments on the top of this file)
   
   Maybe we should only have the `Column` versions and deprecate/remove the 
others but it's kind of a big deal.

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


With regards,
Apache Git Services

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

Reply via email to