Skip to content

Commit

Permalink
return row objects
Browse files Browse the repository at this point in the history
  • Loading branch information
ahirreddy committed Apr 15, 2014
1 parent 4fe1319 commit 55d1c76
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/pyspark/rdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,11 @@ def _jrdd(self):
def _is_pipelinable(self):
return not (self.is_cached or self.is_checkpointed)

class Row:

def __init__(self, d):
self.__dict__ = dict(self.__dict__.items() + d.items())

class SchemaRDD:

def __init__(self, jschema_rdd, sql_ctx):
Expand All @@ -1400,7 +1405,7 @@ def registerAsTable(self, name):
def toPython(self):
jrdd = self._jschema_rdd.javaToPython()
#jrdd = self._sc._javaToPython(self._jschema_rdd)
return RDD(jrdd, self._sc, self._sc.serializer)
return RDD(jrdd, self._sc, self._sc.serializer).map(lambda d: Row(d))

def _test():
import doctest
Expand Down

0 comments on commit 55d1c76

Please sign in to comment.