You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ma...@apache.org on 2021/07/15 13:52:25 UTC
[spark] branch branch-3.2 updated: [SPARK-36154][DOCS] Documenting
week and quarter as valid formats in pyspark sql/functions trunc
This is an automated email from the ASF dual-hosted git repository.
maxgekk pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.2 by this push:
new 3a09024 [SPARK-36154][DOCS] Documenting week and quarter as valid formats in pyspark sql/functions trunc
3a09024 is described below
commit 3a0902463680abeadb46d5bd6b99cfc72e836c8d
Author: Dominik Gehl <do...@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 <do...@open.ch>
Signed-off-by: Max Gekk <ma...@gmail.com>
(cherry picked from commit 802f632a28e46538053c056d1ce43374f80454ae)
Signed-off-by: Max Gekk <ma...@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 656206f..2adff08 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 6079949..d4f527d 100644
--- a/python/pyspark/sql/functions.py
+++ b/python/pyspark/sql/functions.py
@@ -2042,7 +2042,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
--------
@@ -2065,8 +2067,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-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org