GitHub user viirya opened a pull request: https://github.com/apache/spark/pull/19085
[SPARK-21534][SQL][PySpark] PickleException when creating dataframe from python row with empty bytearray ## What changes were proposed in this pull request? `PickleException` is thrown when creating dataframe from python row with empty bytearray spark.createDataFrame(spark.sql("select unhex('') as xx").rdd.map(lambda x: {"abc": x.xx})).show() net.razorvine.pickle.PickleException: invalid pickle data for bytearray; expected 1 or 2 args, got 0 at net.razorvine.pickle.objects.ByteArrayConstructor.construct(ByteArrayConstructor.java ... `ByteArrayConstructor` doesn't deal with empty byte array pickled by Python3. ## How was this patch tested? Added test. You can merge this pull request into a Git repository by running: $ git pull https://github.com/viirya/spark-1 SPARK-21534 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/19085.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #19085 ---- commit a362d6be80cb96e9a29b452e3c97a7191a30b55b Author: Liang-Chi Hsieh <vii...@gmail.com> Date: 2017-08-30T08:59:47Z Add custom ByteArrayConstructor to unpickle empty byte array. ---- --- 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