Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig >> mail # user >> How to create a data bag containing multiple data bags


Copy link to this message
-
Re: How to create a data bag containing multiple data bags
Note bag is a collection of tuples, so { {(1,2,3)},{(1,3)} } should be
{ ({(1,2,3)}),({(1,3)}) }. The bag syntax will be supported in 0.10
coming soon, see PIG-1387.

Daniel

On Fri, Mar 23, 2012 at 8:24 PM, Yongzhi Wang
<[EMAIL PROTECTED]> wrote:
> Hi, All
>
> I was wondering if Pig script can support to create a data bag containing
> several sub data bags.
>
> For example, in the below script,
>
> C = COGROUP A BY a1 inner, B BY b1 inner;
>
> DUMP C;
> (1,{(1,2,3)},{(1,3)})
> (4,{(4,2,1),(4,3,3)},{(4,6),(4,9)})
> (8,{(8,3,4),(8,4,3)},{(8,9)})
>
>
> how can I construct bags like { {(1,2,3)},{(1,3)} }, {
> {(4,2,1),(4,3,3)},{(4,6),(4,9)} }, { {(8,3,4),(8,4,3)},{(8,9)} }. in the
> "FOREACH" statement.
>
> I tried something like
>
> FOREACH C GENERATE group, {$1, $2};
>
> But I got "Syntax error, unexpected symbol at or near '{'" error.
>
> Thanks!
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB