Skip to content

Commit

Permalink
remove workaround to cast string col for Python 2
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanCutler committed Apr 9, 2019
1 parent 87dc661 commit c3e0c26
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions python/pyspark/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,6 @@ def create_array(s, t):
s = _check_series_convert_timestamps_internal(s.fillna(0), self._timezone)
# TODO: need cast after Arrow conversion, ns values cause error with pandas 0.19.2
return pa.Array.from_pandas(s, mask=mask).cast(t, safe=False)
elif t is not None and pa.types.is_string(t) and sys.version < '3':
# TODO: need decode before converting to Arrow in Python 2
# TODO: don't need as of Arrow 0.9.1
return pa.Array.from_pandas(s.apply(
lambda v: v.decode("utf-8") if isinstance(v, str) else v), mask=mask, type=t)

try:
array = pa.Array.from_pandas(s, mask=mask, type=t, safe=self._safecheck)
Expand Down

0 comments on commit c3e0c26

Please sign in to comment.