dongjoon-hyun commented on code in PR #57185:
URL: https://github.com/apache/spark/pull/57185#discussion_r3561192265


##########
python/pyspark/sql/functions/builtin.py:
##########
@@ -14133,13 +14475,15 @@ def crc32(col: "ColumnOrName") -> Column:
     ----------
     col : :class:`~pyspark.sql.Column` or column name
         target column to compute on.
+        A column that evaluates to a binary.
 
     Returns
     -------
     :class:`~pyspark.sql.Column`
         the column for computed results.
 
     .. versionadded:: 1.5.0
+        Returns a column that evaluates to a long.

Review Comment:
   The return-type phrase was inserted under the `.. versionadded:: 1.5.0` 
directive, so Sphinx renders it as "New in version 1.5.0: Returns a column that 
evaluates to a long." instead of as part of the `Returns` description. Shall we 
move like the following?
   
   ```suggestion
           the column for computed results.
           Returns a column that evaluates to a long.
   
       .. versionadded:: 1.5.0
   ```



##########
python/pyspark/sql/functions/builtin.py:
##########
@@ -7533,13 +7701,16 @@ def nanvl(col1: "ColumnOrName", col2: "ColumnOrName") 
-> Column:
     ----------
     col1 : :class:`~pyspark.sql.Column` or column name
         first column to check.
+        A column that evaluates to a double or float.
     col2 : :class:`~pyspark.sql.Column` or column name
         second column to return if first is NaN.
+        A column that evaluates to a double or float.
 
     Returns
     -------
     :class:`~pyspark.sql.Column`
         value from first column or second if first is NaN .
+        Returns a column that evaluates to a double.

Review Comment:
   `NaNvl.dataType` is `left.dataType`, and both inputs accept `DoubleType` or 
`FloatType` — so when both inputs are floats the result is a float, not a 
double.
   
   ```suggestion
           Returns a column of the same type as the first input.
   ```



##########
python/pyspark/sql/functions/builtin.py:
##########
@@ -10962,6 +11208,7 @@ def date_part(field: Column, source: "ColumnOrName") -> 
Column:
     -------
     :class:`~pyspark.sql.Column`
         a part of the date/timestamp or interval source.
+        Returns a column that evaluates to a double.

Review Comment:
   Same as `extract` above — the result type depends on the field (integer for 
most fields, decimal(8,6) for `SECOND`), never a double.
   
   ```suggestion
           Returns a column whose type depends on the field to extract, e.g. an 
integer
           for ``YEAR`` and a decimal for ``SECOND``.
   ```



##########
python/pyspark/sql/functions/builtin.py:
##########
@@ -11017,6 +11264,7 @@ def datepart(field: Column, source: "ColumnOrName") -> 
Column:
     -------
     :class:`~pyspark.sql.Column`
         a part of the date/timestamp or interval source.
+        Returns a column that evaluates to a double.

Review Comment:
   Same as `extract`/`date_part` above — the result type depends on the field, 
never a double.
   
   ```suggestion
           Returns a column whose type depends on the field to extract, e.g. an 
integer
           for ``YEAR`` and a decimal for ``SECOND``.
   ```



##########
python/pyspark/sql/functions/builtin.py:
##########
@@ -10907,6 +11152,7 @@ def extract(field: Column, source: "ColumnOrName") -> 
Column:
     -------
     :class:`~pyspark.sql.Column`
         a part of the date/timestamp or interval source.
+        Returns a column that evaluates to a double.

Review Comment:
   The result type of `extract` depends on the field, and is never a double — 
`DatePart.parseExtractField` resolves to `Year`/`Month`/... (integer) for most 
fields and `SecondWithFraction` (decimal(8,6)) for `SECOND`. The doctest right 
below also shows `year=2015` (integer) and `second=15.000000` (decimal).
   
   ```suggestion
           Returns a column whose type depends on the field to extract, e.g. an 
integer
           for ``YEAR`` and a decimal for ``SECOND``.
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to