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

[jira] [Assigned] (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 ]

Apache Spark reassigned SPARK-21327:
------------------------------------

    Assignee:     (was: Apache Spark)

> 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
>
> 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