利用hadoop来解决“单表关联”的问题

已知

child parent
a b
a c
d b
d c
b e
b f
c g
c h
x g
x h
m x
m n
o x
o n

c	2+c+g 2+c+h 1+a+c 1+d+c
h	1+c+h 1+x+h
d	2+d+b 2+d+c
b	1+a+b 1+d+b 2+b+e 2+b+f
o	2+o+x 2+o+n 
e   1+b+e
m	2+m+x 2+m+n
x	2+x+g 2+x+h 1+m+x 1+o+x
a	2+a+c 2+a+b

也即

gc[0] = a gc[1]=d
gp[0] = g  gp[1] = h   

gc[0] = a gc[1]=d
gp[0] = e  gp[1] = f   

gc[0] = m gc[1]=o
gp[0] = g  gp[1] = h   

grandchild	grandparent
a	g
a	h
d	g
d	h
a	e
a	f
d	e
d	f
m	g
m	h
o	g
o	h
原文地址:https://www.cnblogs.com/tommyli/p/3372500.html