{"id":1948,"date":"2018-08-30T21:37:25","date_gmt":"2018-08-30T19:37:25","guid":{"rendered":"http:\/\/van-maanen.com\/?p=1948"},"modified":"2018-08-30T21:37:25","modified_gmt":"2018-08-30T19:37:25","slug":"joining-files-by-pig","status":"publish","type":"post","link":"http:\/\/archief.van-maanen.com\/?p=1948","title":{"rendered":"Joining files by Pig"},"content":{"rendered":"<p>In the <a href=\"http:\/\/van-maanen.com\/index.php\/2018\/08\/30\/joining-files-by-scala\/\">previous post<\/a>, we used scala to merge two files. The interesting feature is that scala bypasses Mapreduce. Pig uses Mapreduce. If we undertake the same example, we will see a serious performance difference.<\/p>\n<pre>\nfooOriginal = LOAD '\/user\/prut\/foo' USING PigStorage('|')\nAS (id :long, foo:long);\nbarOriginal = LOAD '\/user\/prut\/bar' USING PigStorage('|')\nAS (id :long, bar:long);\njoinedValues = JOIN fooOriginal by id, barOriginal by id;\nstore joinedValues into '\/user\/pig' USING PigStorage('|');\n<\/pre>\n<p>The end result will be written to a HDFS file that is stored in the directory \/user\/pig.<br \/>\nOf course, the results are the same; on the other hand, we see a serious performance difference. Reason being that under water, mapreduce is used.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the previous post, we used scala to merge two files. The interesting feature is that scala bypasses Mapreduce. Pig uses Mapreduce. If we undertake the same example, we will see a serious performance difference. fooOriginal = LOAD &#8216;\/user\/prut\/foo&#8217; USING PigStorage(&#8216;|&#8217;) AS (id :long, foo:long); barOriginal = LOAD &#8216;\/user\/prut\/bar&#8217; USING PigStorage(&#8216;|&#8217;) AS (id :long, bar:long); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1948","post","type-post","status-publish","format-standard","hentry","category-data-warehousing"],"_links":{"self":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/1948","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1948"}],"version-history":[{"count":0,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/1948\/revisions"}],"wp:attachment":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1948"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1948"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1948"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}