.monospace[a.txt]
.monospace[
table | 5 | 1 |
pc | 2 | 1 |
chair | 2 | 1 |
chair | 3 | 2 |
pc | 1 | 6 |
]
.monospace[b.txt]
.monospace[
]
|
|
.small-font[
```pig
A = LOAD 'a.txt' AS
(product:chararray,
weight:int,
units:int);
B = GROUP A ALL;
C = GROUP A BY units*weight;
D = LOAD 'b.txt' AS
(owner:chararray,
owned:chararray);
E = COGROUP A BY product,
D BY owned;
```]
|
|
.smaller-font[
.monospace.darkred[B]
.monospace[
A:{(product:chararray,weight:int, units:int)} |
.inline-code[
```pig
{(table,5,1), (pc,2,1), (chair,2,1),```
```pig
(chair,3,2), (pc,1,6)}```] |
]
.monospace.darkred[C]
.monospace[
group:int | A:{…} |
.hljs-number[5] | .inline-code[
```pig
{(table,5,1)}```] |
.hljs-number[2] | .inline-code[
```pig
{(pc,2,1), (chair,2,1)}```] |
.hljs-number[6] | .inline-code[
```pig
{(chair,3,2), (pc,1,6)}```] |
]
.monospace.darkred[E]
.monospace[
group:chararray | A:{…} | D:{…} |
.darkred[table] | .inline-code[
```pig
{(table,5,1)}```] |
.inline-code[
```pig
{(P1,table)}```] |
.darkred[pc] | .inline-code[
```pig
{(pc,2,1),```
```pig
(pc,1,6)}```] | .inline-code[
```pig
{(P2,pc)}```] |
.darkred[chair] | .inline-code[
```pig
{(chair,2,1),```
```pig
(chair,3,2)}```] | .inline-code[
```pig
{}```] |
]
]
|