18 lines
338 B
Python
Executable File
18 lines
338 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
from pyspark import SparkContext, SparkConf
|
|
|
|
|
|
def make_plural(word):
|
|
return word + "s"
|
|
|
|
|
|
sc = SparkContext()
|
|
animal_list = ['dog', 'cat', 'rabbit', 'hare', 'deer', 'gull', 'woodpecker', 'mole']
|
|
|
|
animal_rdd = sc.parallelize(animal_list, 2)
|
|
|
|
plural_rdd = animal_rdd.map(make_plural)
|
|
|
|
print(plural_rdd.collect())
|