You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Davies Liu (JIRA)" <ji...@apache.org> on 2015/08/08 17:38:45 UTC

[jira] [Resolved] (SPARK-6902) Row() object can be mutated even though it should be immutable

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

Davies Liu resolved SPARK-6902.
-------------------------------
       Resolution: Fixed
    Fix Version/s: 1.5.0

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

> Row() object can be mutated even though it should be immutable
> --------------------------------------------------------------
>
>                 Key: SPARK-6902
>                 URL: https://issues.apache.org/jira/browse/SPARK-6902
>             Project: Spark
>          Issue Type: Bug
>          Components: PySpark, SQL
>    Affects Versions: 1.2.0
>            Reporter: Jonathan Arfa
>            Assignee: Davies Liu
>             Fix For: 1.5.0
>
>
> See the below code snippet, IMHO it shouldn't let you assign {{x.c = 5}} and should just give you an error.
> {quote}
> Welcome to
>       ____              __
>      / __/__  ___ _____/ /__
>     _\ \/ _ \/ _ `/ __/  '_/
>    /__ / .__/\_,_/_/ /_/\_\   version 1.2.0-SNAPSHOT
>       /_/
> Using Python version 2.6.6 (r266:84292, Jan 22 2014 09:42:36)
> SparkContext available as sc.
> >>> from pyspark.sql import *
> >>> x = Row(a=1, b=2, c=3)
> >>> x
> Row(a=1, b=2, c=3)
> >>> x.__dict__
> \{'__FIELDS__': ['a', 'b', 'c']\}
> >>> x.c
> 3
> >>> x.c = 5
> >>> x
> Row(a=1, b=2, c=3)
> >>> x.__dict__
> \{'__FIELDS__': ['a', 'b', 'c'], 'c': 5\}
> >>> x.c
> 5
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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