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

Switch to Threaded View
Pig, mail # user - How can I use load function to load bag field?


Copy link to this message
-
Re: How can I use load function to load bag field?
Russell Jurney 2012-06-11, 17:33
Doesn't need a UDF (if it's PigStorage or something else supported), just a
cast.

foo = LOAD 'location' as B:bag{T2:tuple(t1:float,t2:float)};

Pulled from the docs: http://pig.apache.org/docs/r0.7.0/piglatin_ref2.html

A = LOAD 'mydata' AS (T1:tuple(f1:int, f2:int),
B:bag{T2:tuple(t1:float,t2:float)}, M:map[] );

A = LOAD 'mydata' AS (T1:(f1:int, f2:int), B:{T2:(t1:float,t2:float)}, M:[] );
Russell Jurney
twitter.com/rjurney
[EMAIL PROTECTED]
datasyndrome.com

On Jun 11, 2012, at 9:07 AM, yonghu <[EMAIL PROTECTED]> wrote:

Dear All,

How can I define UDF load function to load the bag field? Such as A = LOAD
'location' as (filed_name : bag {}). Can anyone show me an example code?

Regards!

Yong