This is an automated email from the ASF dual-hosted git repository. maxgekk pushed a commit to branch branch-3.1 in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.1 by this push: new 249b567 [SPARK-36154][DOCS] Documenting week and quarter as valid formats in pyspark sql/functions trunc 249b567 is described below commit 249b567684f977a1af676c4cec14641ae6c75269 Author: Dominik Gehl <d...@open.ch> AuthorDate: Thu Jul 15 16:51:11 2021 +0300 [SPARK-36154][DOCS] Documenting week and quarter as valid formats in pyspark sql/functions trunc ### What changes were proposed in this pull request? Added missing documentation of week and quarter as valid formats to pyspark sql/functions trunc ### Why are the changes needed? Pyspark documentation and scala documentation didn't mentioned the same supported formats ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Only documentation change Closes #33359 from dominikgehl/feature/SPARK-36154. Authored-by: Dominik Gehl <d...@open.ch> Signed-off-by: Max Gekk <max.g...@gmail.com> (cherry picked from commit 802f632a28e46538053c056d1ce43374f80454ae) Signed-off-by: Max Gekk <max.g...@gmail.com> --- R/pkg/R/functions.R | 9 ++++++--- python/pyspark/sql/functions.py | 11 ++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/R/pkg/R/functions.R b/R/pkg/R/functions.R index 28e4ef8..87a75c3 100644 --- a/R/pkg/R/functions.R +++ b/R/pkg/R/functions.R @@ -47,10 +47,13 @@ NULL #' \item \code{to_date} and \code{to_timestamp}: it is the string to use to parse #' Column \code{x} to DateType or TimestampType. #' \item \code{trunc}: it is the string to use to specify the truncation method. -#' For example, "year", "yyyy", "yy" for truncate by year, or "month", "mon", -#' "mm" for truncate by month. +#' 'year', 'yyyy', 'yy' to truncate by year, +#' or 'month', 'mon', 'mm' to truncate by month +#' Other options are: 'week', 'quarter' #' \item \code{date_trunc}: it is similar with \code{trunc}'s but additionally -#' supports "day", "dd", "second", "minute", "hour", "week" and "quarter". +#' supports +#' 'day', 'dd' to truncate by day, +#' 'microsecond', 'millisecond', 'second', 'minute' and 'hour' #' } #' @param ... additional argument(s). #' @name column_datetime_functions diff --git a/python/pyspark/sql/functions.py b/python/pyspark/sql/functions.py index 75a31b7..88b7c4d 100644 --- a/python/pyspark/sql/functions.py +++ b/python/pyspark/sql/functions.py @@ -1941,7 +1941,9 @@ def trunc(date, format): ---------- date : :class:`~pyspark.sql.Column` or str format : str - 'year', 'yyyy', 'yy' or 'month', 'mon', 'mm' + 'year', 'yyyy', 'yy' to truncate by year, + or 'month', 'mon', 'mm' to truncate by month + Other options are: 'week', 'quarter' Examples -------- @@ -1964,8 +1966,11 @@ def date_trunc(format, timestamp): Parameters ---------- format : str - 'year', 'yyyy', 'yy', 'month', 'mon', 'mm', - 'day', 'dd', 'hour', 'minute', 'second', 'week', 'quarter' + 'year', 'yyyy', 'yy' to truncate by year, + 'month', 'mon', 'mm' to truncate by month, + 'day', 'dd' to truncate by day, + Other options are: + 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'week', 'quarter' timestamp : :class:`~pyspark.sql.Column` or str Examples --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org