BryanCutler commented on code in PR #41041:
URL: https://github.com/apache/spark/pull/41041#discussion_r1185559592


##########
python/pyspark/sql/pandas/serializers.py:
##########
@@ -226,9 +225,6 @@ def create_array(s, t):
                 s = _check_series_convert_timestamps_internal(s, 
self._timezone)
             elif t is not None and pa.types.is_map(t):
                 s = _convert_dict_to_map_items(s)
-            elif is_categorical_dtype(s.dtype):
-                # Note: This can be removed once minimum pyarrow version is >= 
0.16.1
-                s = s.astype(s.dtypes.categories.dtype)

Review Comment:
   From what I remember, for versions >= 0.16.1 pyarrow would automatically 
cast a categorical type to what the requested type of `s` was and the result 
was the correct type without this elif block. This was the comment where it was 
brought up https://github.com/apache/spark/pull/26585#discussion_r401853266
   
   I remember testing it out locally without this, but that was quite a while 
ago so something might have changed. That could have also only been the case 
for when `t is not None`. So it makes sense to keep it for that case.



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