[
https://issues.apache.org/jira/browse/SPARK-6902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14566760#comment-14566760
]
Josh Rosen commented on SPARK-6902:
-----------------------------------
If you'd like this to raise a warning, can you open a pull request with tests
to demonstrate how we can handle this? There might be an easy way to implement
warnings / errors here for the common cases, even though it might not work for
some extreme corner-cases.
> 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: [email protected]
For additional commands, e-mail: [email protected]