MapReduce using hadoop streaming via python - Pass a list from mapper to reducer and Read it as a list -
i want pass list value mapper reducer stage.currently, reducer reads list string. there way can make sure python can interpret list.
hadoop streaming uses stdin
, stdout
communication; therefore, coming each subsequent job string. can use kind of delimiter in representation such comma:
the, items, in, my, list
and split them in reducer:
for line in sys.stdin: data = line.split(',')
and if want dictionary:
import ast line in sys.stdin: dict = ast.literal_eval("{'waffle': 'delicious', 'pancake': 'mediocre'}")
there no way know list though because reading standard input stream.
Comments
Post a Comment