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

 ##########
 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:
   The JIRA was meant to be a 1 way conversion from pandas to pyspark as the 
decoded type.  Making a similar categorical type in pyspark might be possible, 
but that's out of scope of the intent here.

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