diff options
author | Davies Liu <davies@databricks.com> | 2014-11-24 16:41:23 -0800 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2014-11-24 16:41:23 -0800 |
commit | 050616b408c60eae02256913ceb645912dbff62e (patch) | |
tree | 16cf868ea95f7f164fefac96be2108a65153a4d8 /python/pyspark/sql.py | |
parent | b660de7a9cbdea3df4a37fbcf60c1c33c71782b8 (diff) | |
download | spark-050616b408c60eae02256913ceb645912dbff62e.tar.gz spark-050616b408c60eae02256913ceb645912dbff62e.tar.bz2 spark-050616b408c60eae02256913ceb645912dbff62e.zip |
[SPARK-4578] fix asDict() with nested Row()
The Row object is created on the fly once the field is accessed, so we should access them by getattr() in asDict(0
Author: Davies Liu <davies@databricks.com>
Closes #3434 from davies/fix_asDict and squashes the following commits:
b20f1e7 [Davies Liu] fix asDict() with nested Row()
Diffstat (limited to 'python/pyspark/sql.py')
-rw-r--r-- | python/pyspark/sql.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/python/pyspark/sql.py b/python/pyspark/sql.py index abb284d1e3..ae288471b0 100644 --- a/python/pyspark/sql.py +++ b/python/pyspark/sql.py @@ -1178,7 +1178,7 @@ def _create_cls(dataType): def asDict(self): """ Return as a dict """ - return dict(zip(self.__FIELDS__, self)) + return dict((n, getattr(self, n)) for n in self.__FIELDS__) def __repr__(self): # call collect __repr__ for nested objects |