GitHub user ericl opened a pull request:
https://github.com/apache/spark/pull/15026
[SPARK-17472] [PYSPARK] Better error message for serialization failures of
large objects in Python
## What changes were proposed in this pull request?
For large objects, pickle does not raise useful error messages. However, we
can wrap them to be slightly more user friendly:
Example 1:
```
def run():
import numpy.random as nr
b = nr.bytes(8 * 1000000000)
sc.parallelize(range(1000), 1000).map(lambda x: len(b)).count()
run()
```
Before:
```
error: 'i' format requires -2147483648 <= number <= 2147483647
```
After:
```
pickle.PicklingError: Object too large to serialize: 'i' format requires
-2147483648 <= number <= 2147483647
```
Example 2:
```
def run():
import numpy.random as nr
b = sc.broadcast(nr.bytes(8 * 1000000000))
sc.parallelize(range(1000), 1000).map(lambda x: len(b.value)).count()
run()
```
Before:
```
SystemError: error return without exception set
```
After:
```
cPickle.PicklingError: Could not serialize broadcast: SystemError: error
return without exception set
```
## How was this patch tested?
Manually tried out these cases
cc @davies
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ericl/spark spark-17472
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/15026.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 #15026
----
commit 33f34614b0620835b55924c3bc486bc7add6e906
Author: Eric Liang <[email protected]>
Date: 2016-09-09T16:52:49Z
Fri Sep 9 09:52:49 PDT 2016
----
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]