nvander1 commented on pull request #31073:
URL: https://github.com/apache/spark/pull/31073#issuecomment-757366750


   For the Java users what about also adding something like an IntervalBuilder
   with methods for .years(...) .days(...)
   Then .build() will produce a Column ?
   
   Then they wouldn’t have to specify all 7 arguments and the user experiences
   would be similar to the default args the Scala users can benefit from.
   
   On Sat, Jan 9, 2021 at 2:14 PM Matthew Powers <[email protected]>
   wrote:
   
   > *@MrPowers* commented on this pull request.
   > ------------------------------
   >
   > In sql/core/src/main/scala/org/apache/spark/sql/functions.scala
   > <https://github.com/apache/spark/pull/31073#discussion_r554461860>:
   >
   > > +  /**
   > +   * Creates a datetime interval
   > +   *
   > +   * @param years Number of years
   > +   * @param months Number of months
   > +   * @param weeks Number of weeks
   > +   * @param days Number of days
   > +   * @param hours Number of hours
   > +   * @param mins Number of mins
   > +   * @param secs Number of secs
   > +   * @return A datetime interval
   > +   * @group datetime_funcs
   > +   * @since 3.2.0
   > +   */
   > +  def make_interval(
   > +      years: Column = lit(0),
   >
   > @MaxGekk <https://github.com/MaxGekk> @HyukjinKwon
   > <https://github.com/HyukjinKwon> - Here's where we currently stand on the
   > default arguments issue:
   >
   >    - Default arguments are not used by other functions in
   >    org.apache.spark.sql.functions, so exposing a function with default
   >    param values isn't consistent with what's been done in the past.
   >    - The default arguments to make_interval make the function better for
   >    Scala users because it allows for this nice syntax make_interval(hours
   >    = lit(2))
   >    - Java users can use the make_interval function that's defined with
   >    the default arguments, as illustrated in this test
   >    
<https://github.com/apache/spark/pull/31073/commits/c9492a99ffa8a3ab1380ebde21c1ea200d02c187>
   >    as long as they supply all seven arguments
   >
   > There are good arguments to use and to avoid default arguments with
   > make_interval. Can you please let me know your updated thoughts on if you
   > think we should use the default values or not? Thank you.
   >
   > —
   > You are receiving this because you commented.
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/spark/pull/31073#discussion_r554461860>, or
   > unsubscribe
   > 
<https://github.com/notifications/unsubscribe-auth/ACXK4VZKAUNROENLLJOQYXDSZCTJBANCNFSM4VYECTKA>
   > .
   >
   


----------------------------------------------------------------
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]



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

Reply via email to