1
votes

SQL

SELECT m.x,m.y,n.a,n.b
from mydata1 m,mydata2 n
WHERE m.x=n.a
AND  m.y>= n.y

PIG

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?

1
As this is not possible try with UDFKumar
try ´CROSS´ in conjunction with ´FILTER´Frederic

1 Answers

2
votes

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;