我在引用 a 中的“父”字段时遇到问题foreach
:
grunt> describe METRICS_SOURCE_WITH_CNT
METRICS_SOURCE_WITH_CNT:
{group: (hostname: chararray,site_guid: chararray,timestamp: long),
JOIN_FIELDS_ONLY: {(timestamp: long, unique_pageviews: long)},cnt: long
请注意,这cnt
是元组的总数。
METRICS_SOURCE_TOP3 = foreach METRICS_SOURCE_WITH_CNT {
SORTED = ORDER JOIN_FIELDS_ONLY by unique_pageviews DESC;
TOPK = LIMIT SORTED 10;
REVSORTED = ORDER JOIN_FIELDS_ONLY by unique_pageviews ASC;
BOTTOMK = LIMIT REVSORTED cnt;
generate TOPK, BOTTOMK;
}
但似乎当我应用第二个时LIMIT
,Pig 认为该cnt
字段在 within REVSORTED
,但它实际上是一个“父”字段。
Invalid field projection. Projected field [cnt] does not exist in schema: timestamp:long,....
我试过按数字引用字段,$x
但它不起作用。Pig 总是认为被引用的字段在被LIMIT
'd的关系内