You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/08/27 13:08:57 UTC

[GitHub] [spark] HyukjinKwon commented on a diff in pull request #37686: [SPARK-40142][PYTHON][SQL][FOLLOW-UP] Make pyspark.sql.functions examples self-contained (part 4, ~26 functions)

HyukjinKwon commented on code in PR #37686:
URL: https://github.com/apache/spark/pull/37686#discussion_r956580243


##########
python/pyspark/sql/functions.py:
##########
@@ -2784,7 +2923,7 @@ def greatest(*cols: "ColumnOrName") -> Column:
 def least(*cols: "ColumnOrName") -> Column:
     """
     Returns the least value of the list of column names, skipping null values.
-    This function takes at least 2 parameters. It will return null iff all parameters are null.
+    This function takes at least 2 parameters. It will return null if all parameters are null.

Review Comment:
   Ithink iff is fine (it's if only if).



##########
python/pyspark/sql/functions.py:
##########
@@ -2925,10 +3120,65 @@ def lag(col: "ColumnOrName", offset: int = 1, default: Optional[Any] = None) ->
     ----------
     col : :class:`~pyspark.sql.Column` or str
         name of column or expression
-    offset : int, optional
+    offset : int, optional default 1
         number of row to extend
-    default : optional
+    default : optional default None
         default value
+
+    Returns
+    -------
+    :class:`~pyspark.sql.Column`
+        row value before current row based on `offset`.

Review Comment:
   ```suggestion
           value before current row based on `offset`.
   ```



##########
python/pyspark/sql/functions.py:
##########
@@ -2925,10 +3120,65 @@ def lag(col: "ColumnOrName", offset: int = 1, default: Optional[Any] = None) ->
     ----------
     col : :class:`~pyspark.sql.Column` or str
         name of column or expression
-    offset : int, optional
+    offset : int, optional default 1
         number of row to extend
-    default : optional
+    default : optional default None

Review Comment:
   ```suggestion
       default : optional
   ```
   optionak implies ``None`` up to my best knowledge. I think we can just remove.



##########
python/pyspark/sql/functions.py:
##########
@@ -2971,11 +3276,56 @@ def nth_value(col: "ColumnOrName", offset: int, ignoreNulls: Optional[bool] = Fa
     ----------
     col : :class:`~pyspark.sql.Column` or str
         name of column or expression
-    offset : int, optional
+    offset : int
         number of row to use as the value
-    ignoreNulls : bool, optional
+    ignoreNulls : bool, optional default False
         indicates the Nth value should skip null in the
         determination of which row to use
+
+    Returns
+    -------
+    :class:`~pyspark.sql.Column`
+        row value of nth row.

Review Comment:
   ```suggestion
           value of nth row.
   ```



##########
python/pyspark/sql/functions.py:
##########
@@ -2971,11 +3276,56 @@ def nth_value(col: "ColumnOrName", offset: int, ignoreNulls: Optional[bool] = Fa
     ----------
     col : :class:`~pyspark.sql.Column` or str
         name of column or expression
-    offset : int, optional
+    offset : int
         number of row to use as the value
-    ignoreNulls : bool, optional
+    ignoreNulls : bool, optional default False

Review Comment:
   ```suggestion
       ignoreNulls : bool, optional
   ```



##########
python/pyspark/sql/functions.py:
##########
@@ -2995,6 +3345,41 @@ def ntile(n: int) -> Column:
     ----------
     n : int
         an integer
+
+    Returns
+    -------
+    :class:`~pyspark.sql.Column`
+        aportioned group id.

Review Comment:
   ```suggestion
           portioned group id.
   ```



##########
python/pyspark/sql/functions.py:
##########
@@ -2947,10 +3197,65 @@ def lead(col: "ColumnOrName", offset: int = 1, default: Optional[Any] = None) ->
     ----------
     col : :class:`~pyspark.sql.Column` or str
         name of column or expression
-    offset : int, optional
+    offset : int, optional default 1
         number of row to extend
-    default : optional
+    default : optional default None

Review Comment:
   ```suggestion
       default : optional
   ```



##########
python/pyspark/sql/functions.py:
##########
@@ -2947,10 +3197,65 @@ def lead(col: "ColumnOrName", offset: int = 1, default: Optional[Any] = None) ->
     ----------
     col : :class:`~pyspark.sql.Column` or str
         name of column or expression
-    offset : int, optional
+    offset : int, optional default 1
         number of row to extend
-    default : optional
+    default : optional default None
         default value
+
+    Returns
+    -------
+    :class:`~pyspark.sql.Column`
+        row value after current row based on `offset`.

Review Comment:
   ```suggestion
           value after current row based on `offset`.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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