假设我们在HDFS的/pig_data/目录中有两个文件,即customers.txt和orders.txt,如下所示。
我们已将这两个文件与客户和订单的关系加载到Pig中,如下所示。
现在让我们使用这两个关系上的cross 运算符获得这两个关系的向量叉积,如下所示。
使用DUMP运算符验证关系cross_data,如下所示。
它将产生以下输出,显示关系cross_data的内容。
(7,Muffy,24,Indore,10000,103,2018-05-20 00:00:00,4,2060)
(7,Muffy,24,Indore,10000,101,2019-11-20 00:00:00,2,1560)
(7,Muffy,24,Indore,10000,100,2019-10-08 00:00:00,3,1500)
(7,Muffy,24,Indore,10000,102,2019-10-08 00:00:00,3,3000)
(6,Komal,22,MP,4500,103,2018-05-20 00:00:00,4,2060)
(6,Komal,22,MP,4500,101,2019-11-20 00:00:00,2,1560)
(6,Komal,22,MP,4500,100,2019-10-08 00:00:00,3,1500)
(6,Komal,22,MP,4500,102,2019-10-08 00:00:00,3,3000)
(5,Hardik,27,Bhopal,8500,103,2018-05-20 00:00:00,4,2060)
(5,Hardik,27,Bhopal,8500,101,2019-11-20 00:00:00,2,1560)
(5,Hardik,27,Bhopal,8500,100,2019-10-08 00:00:00,3,1500)
(5,Hardik,27,Bhopal,8500,102,2019-10-08 00:00:00,3,3000)
(4,Chaitali,25,Mumbai,6500,103,2018-05-20 00:00:00,4,2060)
(4,Chaitali,25,Mumbai,6500,101,2019-20 00:00:00,4,2060)
(2,Khilan,25,Delhi,1500,101,2019-11-20 00:00:00,2,1560)
(2,Khilan,25,Delhi,1500,100,2019-10-08 00:00:00,3,1500)
(2,Khilan,25,Delhi,1500,102,2019-10-08 00:00:00,3,3000)
(1,Ramesh,32,Ahmedabad,2020,103,2018-05-20 00:00:00,4,2060)
(1,Ramesh,32,Ahmedabad,2020,101,2019-11-20 00:00:00,2,1560)
(1,Ramesh,32,Ahmedabad,2020,100,2019-10-08 00:00:00,3,1500)
(1,Ramesh,32,Ahmedabad,2020,102,2019-10-08 00:00:00,3,3000)-11-20 00:00:00,2,1560)
(4,Chaitali,25,Mumbai,6500,100,2019-10-08 00:00:00,3,1500)
(4,Chaitali,25,Mumbai,6500,102,2019-10-08 00:00:00,3,3000)
(3,kaushik,23,Kota,2020,103,2018-05-20 00:00:00,4,2060)
(3,kaushik,23,Kota,2020,101,2019-11-20 00:00:00,2,1560)
(3,kaushik,23,Kota,2020,100,2019-10-08 00:00:00,3,1500)
(3,kaushik,23,Kota,2020,102,2019-10-08 00:00:00,3,3000)
(2,Khilan,25,Delhi,1500,103,2018-05-20 00:00:00,4,2060)
(2,Khilan,25,Delhi,1500,101,2019-11-20 00:00:00,2,1560)
(2,Khilan,25,Delhi,1500,100,2019-10-08 00:00:00,3,1500)
(2,Khilan,25,Delhi,1500,102,2019-10-08 00:00:00,3,3000)
(1,Ramesh,32,Ahmedabad,2020,103,2018-05-20 00:00:00,4,2060)
(1,Ramesh,32,Ahmedabad,2020,101,2019-11-20 00:00:00,2,1560)
(1,Ramesh,32,Ahmedabad,2020,100,2019-10-08 00:00:00,3,1500)
(1,Ramesh,32,Ahmedabad,2020,102,2019-10-08 00:00:00,3,3000)