BryanCutler commented on a change in pull request #23900: [SPARK-23836][PYTHON] 
Add support for StructType return in Scalar Pandas UDF
URL: https://github.com/apache/spark/pull/23900#discussion_r268758759
 
 

 ##########
 File path: python/pyspark/sql/functions.py
 ##########
 @@ -2868,6 +2869,15 @@ def pandas_udf(f=None, returnType=None, 
functionType=None):
        +----------+--------------+------------+
        |         8|      JOHN DOE|          22|
        +----------+--------------+------------+
+       >>> @pandas_udf("first string, last string")  # doctest: +SKIP
 
 Review comment:
   Sometimes type casting is necessary, for example if your integer column has 
null values then Pandas will automatically upcast to floating point to 
represent the nulls as NaNs. If that column is returned then it doesn't make 
sense to keep it as floating point because Spark can handle the null values, so 
using integer return type will cause type casting, but won't cause any problems.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to