如何添加未在架构中定义的固定字段(例如日期或月份)?我运行了以下猪脚本,为我的结果表添加了一个固定日期,并收到以下错误消息: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;
答案 0 :(得分:3)
这是你可能想要的:
result = FOREACH joined_table GENERATE '20140625' as date, A::some_field;