Github user zasdfgbnm commented on a diff in the pull request: https://github.com/apache/spark/pull/18444#discussion_r127513810 --- Diff: python/pyspark/sql/types.py --- @@ -935,6 +936,90 @@ def _parse_datatype_json_value(json_value): long: LongType, }) +# Mapping Python array types to Spark SQL DataType +# We should be careful here. The size of these types in python depends on C +# implementation. We need to make sure that this conversion does not lose any +# precision. +# +# Reference for C integer size, see: +# ISO/IEC 9899:201x specification, chapter 5.2.4.2.1 Sizes of integer types <limits.h>. +# Reference for python array typecode, see: +# https://docs.python.org/2/library/array.html +# https://docs.python.org/3.6/library/array.html + +_array_int_typecode_ctype_mappings = { + 'b': ctypes.c_byte, + 'B': ctypes.c_ubyte, + 'h': ctypes.c_short, + 'H': ctypes.c_ushort, + 'i': ctypes.c_int, + 'I': ctypes.c_uint, + 'l': ctypes.c_long, + 'L': ctypes.c_ulong +} + +# TODO: Uncomment this when 'q' and 'Q' are supported by net.razorvine.pickle --- End diff -- I created a JIRA at https://issues.apache.org/jira/browse/SPARK-21420 I updated the comment here and add reference to that JIRA. I didn't remove this todo because I think it might be a help for future fix. Do you prefer to remove this?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org