Reputation: 85
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);
I now need to join both the tables using the above sql condition. How will I implement the above logic in PIG using the join condition?
Upvotes: 1
Views: 307
Reputation: 2287
Try this :
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;
Upvotes: 2