Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Pig >> mail # user >> Accessing first element in nested bag.


+
Benjamin Juhn 2012-07-07, 22:37
Copy link to this message
-
Re: Accessing first element in nested bag.
Try something like this:

{code}
bags = LOAD '$INPUT_PATH' AS (bag: {(value: chararray)});
first = FOREACH bags {
  one = LIMIT bag 1;
  GENERATE one AS value;
}
{code}

Andy
@sagemintblue
On Sat, Jul 7, 2012 at 3:37 PM, Benjamin Juhn <[EMAIL PROTECTED]> wrote:

> Hi there,
>
> I have a bag with the following schema and I'm having trouble accessing
> the first chararray element.
> {{someString: chararray}}
>
> Can someone advise on the correct syntax?
>
> Thanks,
> Ben