hadoop-mapreduce-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 耿龙 <byr...@gmail.com>
Subject Re: header of a tuple/bag
Date Wed, 17 Jul 2013 16:03:41 GMT
hi, you got the error because you did not arrange name to the fields, pig
did not know which column is called cookie_id. you'd better do like below:

Data = LOAD '/user/xx/20130523/*';

x = FOREACH Data GENERATE (chararray) $i AS cookie_id;

i is the index of the cookie_id in the tuple counting from zero

or you can arrange a schema before you use the data, like

Data = LOAD '/user/xx/20130523/*' AS (cookie_id:chararray);


2013/7/17 Mix Nin <pig.mixed@gmail.com>

> Hi,
>
> I am trying query a data set on HDFS using PIG.
>
> Data = LOAD '/user/xx/20130523/*;
> x = FOREACH Data GENERATE cookie_id;
>
> I get below error.
>
> <line 2, column 26> Invalid field projection. Projected field [cookie_id]
> does not exist
>
> How do i find the column names in the bag "Data" .  The developer who
> created the file says, it is coookie_id.
> Is there any way I could get schema/header for this?
>
>
> Thanks
>
>
>

Mime
View raw message