1
MRJobを使用してMapReduceに基づいてプログラムを書きます。私は減速機のパラメータについて質問があります。ご存じのように、リデューサ関数はキーと値の2つのパラメータを取ります。可能な場合は、ループ条件を記述しないで値の長さを探したい。コードは以下の通りです。MRJob-還元剤の値の長さを見つける
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