callmemissmaybe
callmemissmaybe

Reputation: 1

Pig Help: How can I add a fixed field that is not defined in the schema

How can I add a fixed field (e.g. a date or month) that is not defined in the schema? I ran the following pig script to add a fixed date to my result table and got the following error message : Invalid field projection. Projected field [date] does not exist in schema.

joined_table = join A by (key1), 
                 B by (key1);

result  =  foreach joined_table generate 
                    20140625 as date,
                    A::value1 as v1,
                    B::value1 as v2;

Upvotes: 0

Views: 89

Answers (1)

Explorer
Explorer

Reputation: 143

This is what you may want:

    result = FOREACH joined_table GENERATE '20140625' as date, A::some_field;

Upvotes: 3

Related Questions