<?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: Pig converting tuple to bag in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-converting-tuple-to-bag/m-p/143705#M48343</link>
    <description>&lt;P&gt;I got the answer as below:&lt;/P&gt;&lt;P&gt;isempty_data_1 = filter t_1 by SIZE(failTime)&amp;gt;0; &lt;/P&gt;&lt;P&gt;(23,{(6,Archana,Mishra,23,9848022335,Chennai)}) &lt;/P&gt;&lt;P&gt;(24,{(8,Bharathi,Nambiayar,24,9848022333,Chennai)})&lt;/P&gt;</description>
    <pubDate>Mon, 12 Dec 2016 16:59:45 GMT</pubDate>
    <dc:creator>vamsi123</dc:creator>
    <dc:date>2016-12-12T16:59:45Z</dc:date>
    <item>
      <title>Pig converting tuple to bag</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-converting-tuple-to-bag/m-p/143704#M48342</link>
      <description>&lt;P&gt;I have grouped data as shown below:&lt;/P&gt;&lt;PRE&gt;group_data = GROUP student_details by age;
dump group_data;
(21,{(4,Preethi,Agarwal,21,9848022330,Pune),(1,Rajiv,Reddy,21,9848022337,Hydera bad)})
(22,{(3,Rajesh,Khanna,22,9848022339,Delhi),(2,siddarth,Battacharya,22,984802233 8,Kolkata)})
(23,{(6,Archana,Mishra,23,9848022335,Chennai),(5,Trupthi,Mohanthy,23,9848022336 ,Bhuwaneshwar)})
(24,{(8,Bharathi,Nambiayar,24,9848022333,Chennai),(7,Komal,Nayak,24,9848022334, trivendram)})


Required output from group_data is as below:

(23,{(6,Archana,Mishra,23,9848022335,Chennai)})
(24,{(8,Bharathi,Nambiayar,24,9848022333,Chennai)})
&lt;/PRE&gt;&lt;P&gt;Tried below thing: &lt;/P&gt;&lt;P&gt;First Try:-&lt;/P&gt;&lt;PRE&gt;t = foreach group_data generate group, FLATTEN(student_details1);
filter_data = FILTER t BY student_details::city == 'Chennai';
(23,6,Archana,Mishra,23,9848022335,Chennai)
(24,8,Bharathi,Nambiayar,24,9848022333,Chennai)


&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Second Try:-&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;t_1 = FOREACH group_data {
    t_2 = FILTER student_details BY city == 'Chennai';
    GENERATE group,t_2 AS failTime;
};

(21,{})
(22,{})
(23,{(6,Archana,Mishra,23,9848022335,Chennai)})
(24,{(8,Bharathi,Nambiayar,24,9848022333,Chennai)})
&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Dec 2016 19:33:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-converting-tuple-to-bag/m-p/143704#M48342</guid>
      <dc:creator>vamsi123</dc:creator>
      <dc:date>2016-12-08T19:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: Pig converting tuple to bag</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-converting-tuple-to-bag/m-p/143705#M48343</link>
      <description>&lt;P&gt;I got the answer as below:&lt;/P&gt;&lt;P&gt;isempty_data_1 = filter t_1 by SIZE(failTime)&amp;gt;0; &lt;/P&gt;&lt;P&gt;(23,{(6,Archana,Mishra,23,9848022335,Chennai)}) &lt;/P&gt;&lt;P&gt;(24,{(8,Bharathi,Nambiayar,24,9848022333,Chennai)})&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2016 16:59:45 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-converting-tuple-to-bag/m-p/143705#M48343</guid>
      <dc:creator>vamsi123</dc:creator>
      <dc:date>2016-12-12T16:59:45Z</dc:date>
    </item>
  </channel>
</rss>

