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

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

Copy link to this message
Re: Accessing first element in nested bag.
Try something like this:

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

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