1
MRJob을 사용하여 MapReduce를 기반으로 프로그램을 작성합니다. 감속기의 매개 변수에 대한 질문이 있습니다. 아시다시피, 감속기 기능은 키와 값인 두 가지 매개 변수를 사용합니다. 가능한 경우 루프 조건을 작성하지 않고 값의 길이를 찾고 싶습니다. 코드는 아래에 나와 있습니다.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