I write a program based on MapReduce using MRJob. I have a question about the parameters of reducer. As you know, Reducer function takes two parameters which are key and values. I want to find the length of values without writing any loop condition if it is possible. The code is identified below.
Error is in reducer_IGPLInit function. Error is "TypeError: object of type 'generator' has no len()"
def mapperDataPartition(self, key, line):
p=5
(a, b, c, d) = line.split('\t')
yield randint(1,p),(a,b,c,d)
def reducerDataPartition(self, pVal, records):
for rec in records:
yield pVal, (rec)
def reducer_IGPLInit(self, pVal, records):
yield None, len(records) #### HERE I FACE WITH AN ERROR