diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala index b3aeda852a..a9186ba514 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala @@ -596,6 +596,12 @@ case class WeekOfYear(child: Expression) extends UnaryExpression with ImplicitCa // scalastyle:off line.size.limit @ExpressionDescription( usage = "_FUNC_(timestamp, fmt) - Converts `timestamp` to a value of string in the format specified by the date format `fmt`.", + arguments = """ + Arguments: + * timestamp - A date/timestamp or string to be converted to the given format. + * fmt - Date/time format pattern to follow. See `java.time.format.DateTimeFormatter` for valid date + and time format patterns. + """, examples = """ Examples: > SELECT _FUNC_('2016-04-08', 'y'); @@ -654,7 +660,14 @@ case class DateFormatClass(left: Expression, right: Expression, timeZoneId: Opti * Deterministic version of [[UnixTimestamp]], must have at least one parameter. */ @ExpressionDescription( - usage = "_FUNC_(expr[, pattern]) - Returns the UNIX timestamp of the given time.", + usage = "_FUNC_(timeExp[, format]) - Returns the UNIX timestamp of the given time.", + arguments = """ + Arguments: + * timeExp - A date/timestamp or string which is returned as a UNIX timestamp. + * format - Date/time format pattern to follow. Ignored if `timeExp` is not a string. + Default value is "uuuu-MM-dd HH:mm:ss". See `java.time.format.DateTimeFormatter` + for valid date and time format patterns. + """, examples = """ Examples: > SELECT _FUNC_('2016-04-08', 'yyyy-MM-dd'); @@ -692,7 +705,14 @@ case class ToUnixTimestamp( * second parameter. */ @ExpressionDescription( - usage = "_FUNC_([expr[, pattern]]) - Returns the UNIX timestamp of current or specified time.", + usage = "_FUNC_([timeExp[, format]]) - Returns the UNIX timestamp of current or specified time.", + arguments = """ + Arguments: + * timeExp - A date/timestamp or string. If not provided, this defaults to current time. + * format - Date/time format pattern to follow. Ignored if `timeExp` is not a string. + Default value is "uuuu-MM-dd HH:mm:ss". See `java.time.format.DateTimeFormatter` + for valid date and time format patterns. + """, examples = """ Examples: > SELECT _FUNC_(); @@ -866,6 +886,12 @@ abstract class UnixTime extends ToTimestamp { */ @ExpressionDescription( usage = "_FUNC_(unix_time, format) - Returns `unix_time` in the specified `format`.", + arguments = """ + Arguments: + * unix_time - UNIX Timestamp to be converted to the provided format. + * format - Date/time format pattern to follow. See `java.time.format.DateTimeFormatter` + for valid date and time format patterns. + """, examples = """ Examples: > SELECT _FUNC_(0, 'yyyy-MM-dd HH:mm:ss'); @@ -1408,6 +1434,12 @@ case class ToUTCTimestamp(left: Expression, right: Expression) a date. Returns null with invalid input. By default, it follows casting rules to a date if the `fmt` is omitted. """, + arguments = """ + Arguments: + * date_str - A string to be parsed to date. + * fmt - Date format pattern to follow. See `java.time.format.DateTimeFormatter` for valid + date and time format patterns. + """, examples = """ Examples: > SELECT _FUNC_('2009-07-30 04:17:52'); @@ -1446,10 +1478,16 @@ case class ParseToDate(left: Expression, format: Option[Expression], child: Expr */ @ExpressionDescription( usage = """ - _FUNC_(timestamp[, fmt]) - Parses the `timestamp` expression with the `fmt` expression to - a timestamp. Returns null with invalid input. By default, it follows casting rules to + _FUNC_(timestamp_str[, fmt]) - Parses the `timestamp_str` expression with the `fmt` expression + to a timestamp. Returns null with invalid input. By default, it follows casting rules to a timestamp if the `fmt` is omitted. """, + arguments = """ + Arguments: + * timestamp_str - A string to be parsed to timestamp. + * fmt - Timestamp format pattern to follow. See `java.time.format.DateTimeFormatter` for valid + date and time format patterns. + """, examples = """ Examples: > SELECT _FUNC_('2016-12-31 00:12:00');