SELECT m.x,m.y,n.a,n.b
from mydata1 m,mydata2 n
WHERE m.x=n.a
AND m.y>= n.y
A = LOAD 'mydata1' AS (x: int, y: datetime);
B = LOAD 'mydata2' AS (a: int, b: datetime);
我现在需要使用上面的sql条件加入这两个表。 如何使用连接条件在PIG中实现上述逻辑?
答案 0 :(得分:2)
试试这个:
A = LOAD 'mydata1' AS (x: int, y: datetime);
B = LOAD 'mydata2' AS (a: int, b: datetime);
C = JOIN A BY x, B BY a;
D = FILTER C BY ToUnixTime(y) >= ToUnixTime(b);
DUMP D;