我基于这种结构有2个表:
airports : code,value
fly : idFly,date, codeAirport1, codeAiport2
codeAirport1对应起飞,而codeAirport2对应着陆,因此它们不同 我想获得codeAirport1和codeAirport2的值。我试过这个:
SELECT v1.codeAirport1, v2.codeAiport2
From airports
LEFT JOIN fly v1 ON airports.code = v1.codeAirport1
LEFT JOIN fly v2 ON airports.code = v2.codeAiport2;
但是Hadoop中的工作是无限的,因为reduce步骤总是在运行而且永远不会完成。
提前致谢。
答案 0 :(得分:2)
查询应该是相反的方式:
SELECT
fly.codeAirport1,
a1.value as valueAirport1,
fly.codeAiport2,
a2.value as valueAirport2
FROM
fly
LEFT JOIN
airports a1 ON a1.code = fly.codeAirport1
LEFT JOIN
airports a2 ON a2.code = fly.codeAirport2