<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How can select columns from two relations after join in pig. in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-select-columns-from-two-relations-after-join-in-pig/m-p/161604#M36714</link>
    <description>&lt;P&gt; am able to pick particular columns from relations A &amp;amp; B where relations have schema but if relations doesn't have any schema then it's not working. &lt;/P&gt;</description>
    <pubDate>Wed, 03 Aug 2016 07:03:00 GMT</pubDate>
    <dc:creator>prakash_hadoopd</dc:creator>
    <dc:date>2016-08-03T07:03:00Z</dc:date>
    <item>
      <title>How can select columns from two relations after join in pig.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-select-columns-from-two-relations-after-join-in-pig/m-p/161602#M36712</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;am joining two relations(withoutschema) in pig and want to pick particular columns from both relations. &lt;/P&gt;&lt;P&gt;A = load 'data1' using PigStorage(',');($0,$1...$8)&lt;/P&gt;&lt;P&gt;B = load 'data2' using PigStoarge(',');($0..$4);&lt;/P&gt;&lt;P&gt;C = foreach(join A by($1,$2),B by($1,$2)) generate $0,$1,$4,$5,(how to select B relation columns)&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2016 03:04:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-select-columns-from-two-relations-after-join-in-pig/m-p/161602#M36712</guid>
      <dc:creator>prakash_hadoopd</dc:creator>
      <dc:date>2016-08-03T03:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can select columns from two relations after join in pig.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-select-columns-from-two-relations-after-join-in-pig/m-p/161603#M36713</link>
      <description>&lt;P style="margin-left: 40px;"&gt; &lt;A rel="user" href="https://community.cloudera.com/users/11677/prakashhadoopdev.html" nodeid="11677"&gt;@jayaprakash gadi&lt;/A&gt; please try this.. I haven't tested yet.&lt;/P&gt;&lt;P&gt;C = foreach(join A by($1,$2),B by($1,$2)) generate B.*&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2016 03:33:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-select-columns-from-two-relations-after-join-in-pig/m-p/161603#M36713</guid>
      <dc:creator>sunile_manjee</dc:creator>
      <dc:date>2016-08-03T03:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can select columns from two relations after join in pig.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-select-columns-from-two-relations-after-join-in-pig/m-p/161604#M36714</link>
      <description>&lt;P&gt; am able to pick particular columns from relations A &amp;amp; B where relations have schema but if relations doesn't have any schema then it's not working. &lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2016 07:03:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-select-columns-from-two-relations-after-join-in-pig/m-p/161604#M36714</guid>
      <dc:creator>prakash_hadoopd</dc:creator>
      <dc:date>2016-08-03T07:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can select columns from two relations after join in pig.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-select-columns-from-two-relations-after-join-in-pig/m-p/161605#M36715</link>
      <description>&lt;P&gt;After join the elements from A are at positions $0 .. $8, the elements from B are at $9 .. $13. Also, observe &lt;A href="https://pig.apache.org/docs/r0.15.0/perf.html#performance-enhancers"&gt;Performance enhencers&lt;/A&gt;: Use types, and Project early and often which in your case means to remove un-needed elements before the join.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2016 09:22:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-select-columns-from-two-relations-after-join-in-pig/m-p/161605#M36715</guid>
      <dc:creator>pminovic</dc:creator>
      <dc:date>2016-08-03T09:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: How can select columns from two relations after join in pig.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-select-columns-from-two-relations-after-join-in-pig/m-p/161606#M36716</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/11677/prakashhadoopdev.html" nodeid="11677"&gt;@jayaprakash gadi&lt;/A&gt;&lt;/P&gt;&lt;P&gt;here's my solution, considering that result of join is sum of all fields, then if you have 10 columns in A and 4 columns in B, your result row will 14, you can cherry pick columns 1, 2,3 from A and 11, 12, 13 from B.&lt;/P&gt;&lt;PRE&gt;grunt&amp;gt; fs -cat email_list.csv;
1,Christine,Romero,cromero0@eventbrite.com
2,Sara,Hansen,shansen1@tinypic.com
3,Albert,Rogers,arogers2@marriott.com
4,Kimberly,Morrison,kmorrison3@irs.gov
5,Eugene,Baker,ebaker4@cbslocal.com
6,Ann,Alexander,aalexander5@hhs.gov
7,Kathleen,Reed,kreed6@youtu.be
8,Todd,Scott,tscott7@deliciousdays.com
9,Sharon,Mccoy,smccoy8@nature.com
10,Evelyn,Rice,erice9@narod.ru

grunt&amp;gt; fs -cat gender_list.csv;
1,Christine,Romero,Female
2,Sara,Hansen,Female
3,Albert,Rogers,Male
4,Kimberly,Morrison,Female
5,Eugene,Baker,Male
6,Ann,Alexander,Female
7,Kathleen,Reed,Female
8,Todd,Scott,Male
9,Sharon,Mccoy,Female
10,Evelyn,Rice,Female

grunt&amp;gt; A = load 'email_list.csv' using PigStorage(',');
grunt&amp;gt; B = load 'gender_list.csv' using PigStorage(',');
grunt&amp;gt; C = join A by ($0, $1, $2), B by ($0, $1, $2);
grunt&amp;gt; dump C;

(1,Christine,Romero,cromero0@eventbrite.com,1,Christine,Romero,Female)
(10,Evelyn,Rice,erice9@narod.ru,10,Evelyn,Rice,Female)
(2,Sara,Hansen,shansen1@tinypic.com,2,Sara,Hansen,Female)
(3,Albert,Rogers,arogers2@marriott.com,3,Albert,Rogers,Male)
(4,Kimberly,Morrison,kmorrison3@irs.gov,4,Kimberly,Morrison,Female)
(5,Eugene,Baker,ebaker4@cbslocal.com,5,Eugene,Baker,Male)
(6,Ann,Alexander,aalexander5@hhs.gov,6,Ann,Alexander,Female)
(7,Kathleen,Reed,kreed6@youtu.be,7,Kathleen,Reed,Female)
(8,Todd,Scott,tscott7@deliciousdays.com,8,Todd,Scott,Male)
(9,Sharon,Mccoy,smccoy8@nature.com,9,Sharon,Mccoy,Female)

grunt&amp;gt; D = foreach C generate $0, $1, $2, $3, $7;
grunt&amp;gt; dump D;

(1,Christine,Romero,cromero0@eventbrite.com,Female)
(10,Evelyn,Rice,erice9@narod.ru,Female)
(2,Sara,Hansen,shansen1@tinypic.com,Female)
(3,Albert,Rogers,arogers2@marriott.com,Male)
(4,Kimberly,Morrison,kmorrison3@irs.gov,Female)
(5,Eugene,Baker,ebaker4@cbslocal.com,Male)
(6,Ann,Alexander,aalexander5@hhs.gov,Female)
(7,Kathleen,Reed,kreed6@youtu.be,Female)
(8,Todd,Scott,tscott7@deliciousdays.com,Male)
(9,Sharon,Mccoy,smccoy8@nature.com,Female)
&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Aug 2016 00:55:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-select-columns-from-two-relations-after-join-in-pig/m-p/161606#M36716</guid>
      <dc:creator>aervits</dc:creator>
      <dc:date>2016-08-04T00:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: How can select columns from two relations after join in pig.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-select-columns-from-two-relations-after-join-in-pig/m-p/161607#M36717</link>
      <description>&lt;P&gt;it worked ..thanks&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2016 01:39:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-select-columns-from-two-relations-after-join-in-pig/m-p/161607#M36717</guid>
      <dc:creator>prakash_hadoopd</dc:creator>
      <dc:date>2016-08-05T01:39:25Z</dc:date>
    </item>
  </channel>
</rss>

