Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test case for lookup()
  • Loading branch information
davies committed Aug 23, 2014
commit 0f1bce8bbf6ca8ccec04f7030707f5a01f3a15ae
2 changes: 2 additions & 0 deletions python/pyspark/rdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1711,6 +1711,8 @@ def lookup(self, key):
>>> sorted = rdd.sortByKey()
>>> sorted.lookup(42) # fast
[42]
>>> sorted.lookup(1024)
[]
"""
self = self.filter(lambda (k, v): k == key).values()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reassignment to self seems potentially confusing. Could you use a different name for the filtered RDD, such as filtered? I think even a one-letter variable name, like f, is preferable to re-assigning self.


Expand Down