Skip to content

Commit

Permalink
rollback loads()
Browse files Browse the repository at this point in the history
  • Loading branch information
davies committed Aug 20, 2014
1 parent 85246e5 commit a286f2f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions python/pyspark/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,15 +412,15 @@ class UTF8Deserializer(Serializer):
def __init__(self, use_unicode=False):
self.use_unicode = use_unicode

def loads(self, stream):
length = read_int(stream)
s = stream.read(length)
return s.decode("utf-8") if self.use_unicode else s

def load_stream(self, stream):
try:
_read_int = read_int # faster than global lookup
if self.use_unicode:
while True:
yield stream.read(_read_int(stream)).decode("utf-8")
else:
while True:
yield stream.read(_read_int(stream))
while True:
yield self.loads(stream)
except struct.error:
return
except EOFError:
Expand Down

0 comments on commit a286f2f

Please sign in to comment.