我有这些关系:
a01x = FOREACH a01 GENERATE ndggr, 1 AS c1, 0 AS c2, 0 AS c3, 0 AS c4, 0 AS c5, 0 AS c6, 0 AS c7, 0 AS c8;
a02x = FOREACH a02 GENERATE ndggr, 0 AS c1, 1 AS c2, 0 AS c3, 0 AS c4, 0 AS c5, 0 AS c6, 0 AS c7, 0 AS c8;
a03x = FOREACH a03 GENERATE ndggr, 0 AS c1, 0 AS c2, 1 AS c3, 0 AS c4, 0 AS c5, 0 AS c6, 0 AS c7, 0 AS c8;
a04x = FOREACH a04 GENERATE ndggr, 0 AS c1, 0 AS c2, 0 AS c3, 1 AS c4, 0 AS c5, 0 AS c6, 0 AS c7, 0 AS c8;
a05x = FOREACH a05 GENERATE ndggr, 0 AS c1, 0 AS c2, 0 AS c3, 0 AS c4, 1 AS c5, 0 AS c6, 0 AS c7, 0 AS c8;
a06x = FOREACH a06 GENERATE ndggr, 0 AS c1, 0 AS c2, 0 AS c3, 0 AS c4, 0 AS c5, 1 AS c6, 0 AS c7, 0 AS c8;
a07x = FOREACH a07 GENERATE ndggr, 0 AS c1, 0 AS c2, 0 AS c3, 0 AS c4, 0 AS c5, 0 AS c6, 1 AS c7, 0 AS c8;
a08x = FOREACH a08 GENERATE ndggr, 0 AS c1, 0 AS c2, 0 AS c3, 0 AS c4, 0 AS c5, 0 AS c6, 0 AS c7, 1 AS c8;
aunion = UNION a01x, a02x, a03x, a04x, a05x, a06x, a07x, a08x;
agroups = GROUP aunion BY ndggr;
考虑到ndggr是我的密钥,我想得到一个关系,其中每个元组都是这样的
001, 1, 0, 0, 0, 1, 1, 0, 1
155, 0, 0, 0, 1, 1, 0, 1, 1
200, 1, 0, 0, 0, 0, 0, 0, 1
所以对于每一组我都想要
ndggr, MAX(c1), MAX(c2), ... , MAX(c8)
我怎么能得到这个?
1条答案
按热度按时间gdx19jrr1#
考虑阅读一些基本的apache pig文档。