You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Jonathan Arfa (JIRA)" <ji...@apache.org> on 2015/04/14 16:58:12 UTC

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

Jonathan Arfa created SPARK-6902:
------------------------------------

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


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