Skip to content

Commit 88091ea

Browse files
committed
dirty hacking to recover 'L' support in python2
1 parent cafa5fd commit 88091ea

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

python/pyspark/sql/types.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,14 @@ def _int_size_to_type(size):
993993
if sys.version_info[0] < 3:
994994
_array_type_mappings['c'] = StringType
995995

996+
# SPARK-21465:
997+
# In python2, array of 'L' happened to be mistakenly partially supported. To
998+
# avoid breaking user's code, we should keep this partial support. Below is a
999+
# dirty hacking to keep this partial support and make the unit test passes
1000+
if sys.version_info[0] < 3 and 'L' not in _array_type_mappings.keys():
1001+
_array_type_mappings['L'] = LongType
1002+
_array_unsigned_int_typecode_ctype_mappings['L'] = ctypes.c_uint
1003+
9961004

9971005
def _infer_type(obj):
9981006
"""Infer the DataType from obj

0 commit comments

Comments
 (0)