GitHub user ueshin opened a pull request:
https://github.com/apache/spark/pull/18553
[SPARK-21327][SQL][PYSPARK] ArrayConstructor should handle an array of
typecode 'l' as long rather than int in Python 2.
## What changes were proposed in this pull request?
Currently `ArrayConstructor` handles an array of typecode `'l'` as `int`
when converting Python object in Python 2 into Java object, so if the value is
larger than `Integer.MAX_VALUE` or smaller than `Integer.MIN_VALUE` then the
overflow occurs.
```python
import array
data = [Row(l=array.array('l', [-9223372036854775808, 0,
9223372036854775807]))]
df = spark.createDataFrame(data)
df.show(truncate=False)
```
```
+----------+
|l |
+----------+
|[0, 0, -1]|
+----------+
```
This should be:
```
+----------------------------------------------+
|l |
+----------------------------------------------+
|[-9223372036854775808, 0, 9223372036854775807]|
+----------------------------------------------+
```
## How was this patch tested?
Added a test and existing tests.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ueshin/apache-spark issues/SPARK-21327
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/18553.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 #18553
----
commit c729effe944075db3a563a522316ef85250cf322
Author: Takuya UESHIN <[email protected]>
Date: 2017-07-06T08:38:14Z
Modify ArrayConstructor to handle an array of typecode 'l' as long rather
than int.
----
---
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]