2014-12-11 6 views
0

정말 작은 데이터 세트 임에도 불구하고 다중 데카르트 조인을 수행 할 때 메모리 오류가 발생합니다. 아무도 이것이 왜 일어날 지 설명 할 수 있습니까?다중 데카르트 조인 pySpark

In [1]: foo = sc.records([{'foo': 123}, {'foo': 321}]) 
In [2]: bar = sc.records([{'bar': 123}, {'bar': 321}]) 
In [3]: baz = sc.records([{'baz': 123}, {'baz': 321}]) 
In [4]: qux = foo.cartesian(bar)\ 
    ...:   .map(lambda (x,y): x.merge(y))\ 
    ...:   .cartesian(baz)\ 
    ...:   .map(lambda (x,y): x.merge(y)) 
In [5]: qux.collect() 

java.lang.OutOfMemoryError: GC overhead limit exceeded 

답변

0

나는 내 자신의 cartesianJoin의 함수를 정의 결국

def cartesianJoin(self, other): 
    return self.map(lambda rec: (0, rec)).join(other.map(lambda rec: (0, rec))).map(lambda (key, (x, y)): x.merge(y)) 
end