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/05/16 00:17:00 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=14546274#comment-14546274 ]
Davies Liu commented on SPARK-6902:
-----------------------------------
[~jarfa] Python is a dynamic language, it's not common to provide read-only interface (there are many ways to break it), so I'd like to leave it as current (won't fix). Does this work for you?
> 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
>
> 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