Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1977#discussion_r27994956
  
    --- Diff: python/pyspark/shuffle.py ---
    @@ -529,6 +520,295 @@ def sorted(self, iterator, key=None, reverse=False):
             return heapq.merge(chunks, key=key, reverse=reverse)
     
     
    +class ExternalList(object):
    +    """
    +    ExternalList can have many items which cannot be hold in memory in
    +    the same time.
    +
    +    >>> l = ExternalList(range(100))
    +    >>> len(l)
    +    100
    +    >>> l.append(10)
    +    >>> len(l)
    +    101
    +    >>> for i in range(10240):
    +    ...     l.append(i)
    +    >>> len(l)
    +    10341
    +    >>> import pickle
    +    >>> l2 = pickle.loads(pickle.dumps(l))
    +    >>> len(l2)
    +    10341
    +    >>> list(l2)[100]
    +    10
    +    """
    +    LIMIT = 10240
    +
    +    def __init__(self, values):
    +        self.values = values
    +        self.disk_count = 0
    +        self._file = None
    +        self._ser = None
    +
    +    def __getstate__(self):
    +        if self._file is not None:
    +            self._file.flush()
    +            f = os.fdopen(os.dup(self._file.fileno()))
    +            f.seek(0)
    +            bytes = f.read()
    --- End diff --
    
    I think `bytes` is a reserved word in Python, so maybe we should call this 
`_bytes` instead.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to