Skip to content

Commit 6567fc4

Browse files
rberenguelHyukjinKwon
authored andcommitted
[PYTHON] Fix typo in serializer exception
## What changes were proposed in this pull request? Fix typo in exception raised in Python serializer ## How was this patch tested? No code changes Please review http://spark.apache.org/contributing.html before opening a pull request. Author: Ruben Berenguel Montoro <ruben@mostlymaths.net> Closes #21566 from rberenguel/fix_typo_pyspark_serializers.
1 parent 22daeba commit 6567fc4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

python/pyspark/serializers.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@
3333
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
3434
>>> sc.stop()
3535
36-
PySpark serialize objects in batches; By default, the batch size is chosen based
37-
on the size of objects, also configurable by SparkContext's C{batchSize} parameter:
36+
PySpark serializes objects in batches; by default, the batch size is chosen based
37+
on the size of objects and is also configurable by SparkContext's C{batchSize}
38+
parameter:
3839
3940
>>> sc = SparkContext('local', 'test', batchSize=2)
4041
>>> rdd = sc.parallelize(range(16), 4).map(lambda x: x)
@@ -100,7 +101,7 @@ def load_stream(self, stream):
100101
def _load_stream_without_unbatching(self, stream):
101102
"""
102103
Return an iterator of deserialized batches (iterable) of objects from the input stream.
103-
if the serializer does not operate on batches the default implementation returns an
104+
If the serializer does not operate on batches the default implementation returns an
104105
iterator of single element lists.
105106
"""
106107
return map(lambda x: [x], self.load_stream(stream))
@@ -461,7 +462,7 @@ def dumps(self, obj):
461462
return obj
462463

463464

464-
# Hook namedtuple, make it picklable
465+
# Hack namedtuple, make it picklable
465466

466467
__cls = {}
467468

@@ -525,15 +526,15 @@ def namedtuple(*args, **kwargs):
525526
cls = _old_namedtuple(*args, **kwargs)
526527
return _hack_namedtuple(cls)
527528

528-
# replace namedtuple with new one
529+
# replace namedtuple with the new one
529530
collections.namedtuple.__globals__["_old_namedtuple_kwdefaults"] = _old_namedtuple_kwdefaults
530531
collections.namedtuple.__globals__["_old_namedtuple"] = _old_namedtuple
531532
collections.namedtuple.__globals__["_hack_namedtuple"] = _hack_namedtuple
532533
collections.namedtuple.__code__ = namedtuple.__code__
533534
collections.namedtuple.__hijack = 1
534535

535-
# hack the cls already generated by namedtuple
536-
# those created in other module can be pickled as normal,
536+
# hack the cls already generated by namedtuple.
537+
# Those created in other modules can be pickled as normal,
537538
# so only hack those in __main__ module
538539
for n, o in sys.modules["__main__"].__dict__.items():
539540
if (type(o) is type and o.__base__ is tuple
@@ -627,7 +628,7 @@ def loads(self, obj):
627628
elif _type == b'P':
628629
return pickle.loads(obj[1:])
629630
else:
630-
raise ValueError("invalid sevialization type: %s" % _type)
631+
raise ValueError("invalid serialization type: %s" % _type)
631632

632633

633634
class CompressedSerializer(FramedSerializer):

0 commit comments

Comments
 (0)