You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2023/06/15 12:13:48 UTC

[spark] branch master updated: [SPARK-43941][PYTHON][TESTS][FOLLOWUP] Doctest clean up

This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new fe787efca78 [SPARK-43941][PYTHON][TESTS][FOLLOWUP] Doctest clean up
fe787efca78 is described below

commit fe787efca78de39b56b0a3480686a0e7b881fc73
Author: Ruifeng Zheng <ru...@apache.org>
AuthorDate: Thu Jun 15 21:13:33 2023 +0900

    [SPARK-43941][PYTHON][TESTS][FOLLOWUP] Doctest clean up
    
    ### What changes were proposed in this pull request?
    clean up doctests
    
    ### Why are the changes needed?
    `<BLANKLINE>` in doc test seems depends on os or library version, we should not include it in doctest
    
    ### Does this PR introduce _any_ user-facing change?
    no
    
    ### How was this patch tested?
    updated tests
    
    Closes #41610 from zhengruifeng/43941_test_followup.
    
    Authored-by: Ruifeng Zheng <ru...@apache.org>
    Signed-off-by: Hyukjin Kwon <gu...@apache.org>
---
 python/pyspark/sql/functions.py | 59 -----------------------------------------
 1 file changed, 59 deletions(-)

diff --git a/python/pyspark/sql/functions.py b/python/pyspark/sql/functions.py
index b5c3ec9cec6..e9de8958cc8 100644
--- a/python/pyspark/sql/functions.py
+++ b/python/pyspark/sql/functions.py
@@ -3738,7 +3738,6 @@ def percentile(
     +--------------------+
     |[0.74419914941216...|
     +--------------------+
-    <BLANKLINE>
 
     >>> df.groupBy("key").agg(
     ...     percentile("value", 0.5, lit(1)).alias("median")
@@ -3750,7 +3749,6 @@ def percentile(
     |  1|   9.990389751837329|
     |  2|  19.967859769284075|
     +---+--------------------+
-    <BLANKLINE>
     """
     sc = get_active_spark_context()
 
@@ -4887,17 +4885,6 @@ def any_value(col: "ColumnOrName", ignoreNulls: Optional[Union[bool, Column]] =
     ...                             ("a", 3),
     ...                             ("b", 8),
     ...                             ("b", 2)], ["c1", "c2"])
-    >>> df.show()
-    +----+---+
-    |  c1| c2|
-    +----+---+
-    |NULL|  1|
-    |   a|  2|
-    |   a|  3|
-    |   b|  8|
-    |   b|  2|
-    +----+---+
-    <BLANKLINE>
     >>> df.select(any_value('c1'), any_value('c2')).collect()
     [Row(any_value(c1)=None, any_value(c2)=1)]
     >>> df.select(any_value('c1', True), any_value('c2', True)).collect()
@@ -4936,17 +4923,6 @@ def first_value(col: "ColumnOrName", ignoreNulls: Optional[Union[bool, Column]]
     ...                             ("a", 3),
     ...                             ("b", 8),
     ...                             ("b", 2)], ["c1", "c2"])
-    >>> df.show()
-    +----+---+
-    |  c1| c2|
-    +----+---+
-    |NULL|  1|
-    |   a|  2|
-    |   a|  3|
-    |   b|  8|
-    |   b|  2|
-    +----+---+
-    <BLANKLINE>
     >>> df.select(first_value('c1').alias('a'), first_value('c2').alias('b')).collect()
     [Row(a=None, b=1)]
     >>> df.select(first_value('c1', True).alias('a'), first_value('c2', True).alias('b')).collect()
@@ -4985,17 +4961,6 @@ def last_value(col: "ColumnOrName", ignoreNulls: Optional[Union[bool, Column]] =
     ...                             ("a", 3),
     ...                             ("b", 8),
     ...                             (None, 2)], ["c1", "c2"])
-    >>> df.show()
-    +----+---+
-    |  c1| c2|
-    +----+---+
-    |   a|  1|
-    |   a|  2|
-    |   a|  3|
-    |   b|  8|
-    |NULL|  2|
-    +----+---+
-    <BLANKLINE>
     >>> df.select(last_value('c1').alias('a'), last_value('c2').alias('b')).collect()
     [Row(a=None, b=2)]
     >>> df.select(last_value('c1', True).alias('a'), last_value('c2', True).alias('b')).collect()
@@ -5031,24 +4996,12 @@ def count_if(col: "ColumnOrName") -> Column:
     ...                             ("a", 3),
     ...                             ("b", 8),
     ...                             ("b", 2)], ["c1", "c2"])
-    >>> df.show()
-    +---+---+
-    | c1| c2|
-    +---+---+
-    |  a|  1|
-    |  a|  2|
-    |  a|  3|
-    |  b|  8|
-    |  b|  2|
-    +---+---+
-    <BLANKLINE>
     >>> df.select(count_if(col('c2') % 2 == 0)).show()
     +------------------------+
     |count_if(((c2 % 2) = 0))|
     +------------------------+
     |                       3|
     +------------------------+
-    <BLANKLINE>
     """
     return _invoke_function_over_columns("count_if", col)
 
@@ -5087,24 +5040,12 @@ def histogram_numeric(col: "ColumnOrName", nBins: "ColumnOrName") -> Column:
     ...                             ("a", 3),
     ...                             ("b", 8),
     ...                             ("b", 2)], ["c1", "c2"])
-    >>> df.show()
-    +---+---+
-    | c1| c2|
-    +---+---+
-    |  a|  1|
-    |  a|  2|
-    |  a|  3|
-    |  b|  8|
-    |  b|  2|
-    +---+---+
-    <BLANKLINE>
     >>> df.select(histogram_numeric('c2', lit(5))).show()
     +------------------------+
     |histogram_numeric(c2, 5)|
     +------------------------+
     |    [{1, 1.0}, {2, 1....|
     +------------------------+
-    <BLANKLINE>
     """
     return _invoke_function_over_columns("histogram_numeric", col, nBins)
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org