You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2019/08/20 03:46:04 UTC
[spark] branch branch-2.4 updated: [SPARK-28777][PYTHON][DOCS] Fix
format_string doc string with the correct parameters
This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-2.4 by this push:
new 75076ff [SPARK-28777][PYTHON][DOCS] Fix format_string doc string with the correct parameters
75076ff is described below
commit 75076ffbbeeb6f87f523ace91714e9cf831fa4f5
Author: darrentirto <da...@gmail.com>
AuthorDate: Mon Aug 19 20:44:46 2019 -0700
[SPARK-28777][PYTHON][DOCS] Fix format_string doc string with the correct parameters
### What changes were proposed in this pull request?
The parameters doc string of the function format_string was changed from _col_, _d_ to _format_, _cols_ which is what the actual function declaration states
### Why are the changes needed?
The parameters stated by the documentation was inaccurate
### Does this PR introduce any user-facing change?
Yes.
**BEFORE**

**AFTER**

### How was this patch tested?
N/A: documentation only
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
-->
Closes #25506 from darrentirto/SPARK-28777.
Authored-by: darrentirto <da...@gmail.com>
Signed-off-by: Dongjoon Hyun <dh...@apple.com>
(cherry picked from commit a787bc28840eafae53a08137a53ea56500bfd675)
Signed-off-by: Dongjoon Hyun <dh...@apple.com>
---
python/pyspark/sql/functions.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/python/pyspark/sql/functions.py b/python/pyspark/sql/functions.py
index 37bcaa3..5774f13 100644
--- a/python/pyspark/sql/functions.py
+++ b/python/pyspark/sql/functions.py
@@ -1521,8 +1521,9 @@ def format_string(format, *cols):
"""
Formats the arguments in printf-style and returns the result as a string column.
- :param col: the column name of the numeric value to be formatted
- :param d: the N decimal places
+ :param format: string that can contain embedded format tags and used as result column's value
+ :param cols: list of column names (string) or list of :class:`Column` expressions to
+ be used in formatting
>>> df = spark.createDataFrame([(5, "hello")], ['a', 'b'])
>>> df.select(format_string('%d %s', df.a, df.b).alias('v')).collect()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org