Pig cross on two datasets
-------------------salrec = load '/home/horton/Desktop/Sales.csv' using PigStorage(',') AS
(custid:long, prod_id:long, qty_pur:int, pur_date:datetime, sale_id:long);
custrec = load '/home/horton/Desktop/Customer.csv' using PigStorage(',') AS (fn:chararray, ln:chararray, status:chararray, ph:chararray, custid1:long, add:chararray);
pd_rec = load '/home/horton/Desktop/Product.csv' using PigStorage(',') AS (pdname:chararray, pddesc:chararray, pdcat:chararray, pdgty:long, pdid:long, pkwith:chararray);
crs_rec = cross salrec, pd_rec,custrec ;
STORE crs_rec into '/home/horton/Desktop/pigc1' using PigStorage();
sample output
773 45628 10 2012-01-24T00:00:00.000+05:30 34860 DVD T EXT DVD Tiger Brand External Optical 17 82337 satacable:manual Hubert Mentz A 416-577-8233 312 Bigcity|12345
773 45628 10 2012-01-24T00:00:00.000+05:30 34860 DVD T EXT DVD Tiger Brand External Optical 17 82337 satacable:manual Roger Marjory A 647-290-6776 557 Smallcity|98765
773 45628 10 2012-01-24T00:00:00.000+05:30 34860 DVD T EXT DVD Tiger Brand External Optical 17 82337 satacable:manual Jean Kulinski A 905-409-8823 452 Mediumcity|67890
773 45628 10 2012-01-24T00:00:00.000+05:30 34860 DVD T EXT DVD Tiger Brand External Optical 17 82337 satacable:manual Cliff Brandson I 416-559-0223 3221 Bigcity|12345
773 45628 10 2012-01-24T00:00:00.000+05:30 34860 DVD T EXT DVD Tiger Brand External Optical 17 82337 satacable:manual Lisa Hetzer A 416-980-3229 482 Bigcity|12345
773 45628 10 2012-01-24T00:00:00.000+05:30 34860 DVD T EXT DVD Tiger Brand External Optical 17 82337 satacable:manual Arthur Balgne A 905-311-1211 331 Mediumcity|67890
773 45628 10 2012-01-24T00:00:00.000+05:30 34860 DVD T EXT DVD Tiger Brand External Optical 17 82337 satacable:manual Elizabeth Metzer A 416-322-9001 85 Bigcity|12345
773 45628 10 2012-01-24T00:00:00.000+05:30 34860 DVD T EXT DVD Tiger Brand External Optical 17 82337 satacable:manual
No comments:
Post a Comment