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 <[email protected]>

> 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
>
>
>

Reply via email to