Skip to content
Snippets Groups Projects
Commit bd723bd5 authored by Udo Klein's avatar Udo Klein Committed by Sean Owen
Browse files

removed lambda from sortByKey()

According to the documentation the sortByKey method does not take a lambda as an argument, thus the example is flawed. Removed the argument completely as this will default to ascending sort.

Author: Udo Klein <git@blinkenlight.net>

Closes #10640 from udoklein/patch-1.
parent f253feff
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,7 @@ if __name__ == "__main__":
lines = sc.textFile(sys.argv[1], 1)
sortedCount = lines.flatMap(lambda x: x.split(' ')) \
.map(lambda x: (int(x), 1)) \
.sortByKey(lambda x: x)
.sortByKey()
# This is just a demo on how to bring all the sorted data back to a single node.
# In reality, we wouldn't want to collect all the data to the driver node.
output = sortedCount.collect()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment