HyukjinKwon commented on a change in pull request #26585: 
[WIP][SPARK-25351][SQL][Python] Handle Pandas category type when converting 
from Python with Arrow
URL: https://github.com/apache/spark/pull/26585#discussion_r347719913
 
 

 ##########
 File path: python/pyspark/serializers.py
 ##########
 @@ -298,7 +298,10 @@ def create_array(s, t):
             if t is not None and pa.types.is_timestamp(t):
                 s = _check_series_convert_timestamps_internal(s, 
self._timezone)
             try:
-                array = pa.Array.from_pandas(s, mask=mask, type=t, 
safe=self._safecheck)
+                if str(s.dtype) == 'category':
+                    array = pa.array(s.get_values())
 
 Review comment:
   Hm, I am not sure how we will be able to convert Spark DataFrame -> pandas 
DataFrame with a category type. 
   
   pandas DataFrame -> Spark DataFrame looks easy as you did.

----------------------------------------------------------------
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