You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Takuya Ueshin (JIRA)" <ji...@apache.org> on 2017/07/07 05:06:00 UTC

[jira] [Resolved] (SPARK-21327) ArrayConstructor should handle an array of typecode 'l' as long rather than int in Python 2.

     [ https://issues.apache.org/jira/browse/SPARK-21327?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Takuya Ueshin resolved SPARK-21327.
-----------------------------------
       Resolution: Fixed
    Fix Version/s: 2.3.0

Issue resolved by pull request 18553
[https://github.com/apache/spark/pull/18553]

> ArrayConstructor should handle an array of typecode 'l' as long rather than int in Python 2.
> --------------------------------------------------------------------------------------------
>
>                 Key: SPARK-21327
>                 URL: https://issues.apache.org/jira/browse/SPARK-21327
>             Project: Spark
>          Issue Type: Bug
>          Components: PySpark, SQL
>    Affects Versions: 2.2.0
>            Reporter: Takuya Ueshin
>            Assignee: Takuya Ueshin
>             Fix For: 2.3.0
>
>
> 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.
> {code}
> import array
> data = [Row(l=array.array('l', [-9223372036854775808, 0, 9223372036854775807]))]
> df = spark.createDataFrame(data)
> df.show(truncate=False)
> {code}
> {code}
> +----------+
> |l         |
> +----------+
> |[0, 0, -1]|
> +----------+
> {code}
> This should be:
> {code}
> +----------------------------------------------+
> |l                                             |
> +----------------------------------------------+
> |[-9223372036854775808, 0, 9223372036854775807]|
> +----------------------------------------------+
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org