WeichenXu123 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_r310160808
 
 

 ##########
 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:
   other versions function we can provide implicit conversions from literal 
type to column.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to