手册/文档广泛使用“内袋”和“外袋”的语言(比如: http: //pig.apache.org/docs/r0.11.1/basic.html ),但我还不能明确区分这些术语的精确定义。
例如,所有本质上都是相互关联的:
- 如果我给你一个袋子“foo”,你需要知道什么才能将 foo 标记为“内袋”与“外袋”?
- 不是最外层包的“任何包”是不是“内包”?
- 内在和外在的标签总是排他的吗?
- 在 PigLatin 中,所有的“包”都是“关系”——还是只是“最外层的包”是关系?(和内袋没有关系)
创建一个可讨论的示例:
grunt> dump A;
(1,2,3)
(4,2,1)
(8,3,4)
(4,3,3)
grunt> W1 = GROUP A ALL;
grunt> W2 = GROUP W1 ALL;
grunt> W3 = GROUP W2 ALL;
grunt> W4 = GROUP W3 ALL;
grunt> describe W4;
W4: {group: chararray,W3: {(group: chararray,W2: {(group: chararray,W1: {(group: chararray,A: {(f1: int,f2: int,f3: int)})})})}}
grunt> illustrate W4;
(1,2,3)
---------------------------------------------------
| A | f1:int | f2:int | f3:int |
---------------------------------------------------
| | 1 | 2 | 3 |
| | 8 | 3 | 4 |
---------------------------------------------------
------------------------------------------------------------------------------------------------
| W1 | group:chararray | A:bag{:tuple(f1:int,f2:int,f3:int)} |
------------------------------------------------------------------------------------------------
| | all | {(1, 2, 3), (8, 3, 4)} |
------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------
| W2 | group:chararray | W1:bag{:tuple(group:chararray,A:bag{:tuple(f1:int,f2:int,f3:int)})} |
-----------------------------------------------------------------------------------------------------------------------------------------------
| | all | {(all, {(1, 2, 3), (8, 3, 4)})} |
-----------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| W3 | group:chararray | W2:bag{:tuple(group:chararray,W1:bag{:tuple(group:chararray,A:bag{:tuple(f1:int,f2:int,f3:int)})})} |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| | all | {(all, {(all, {(1, 2, 3), (8, 3, 4)})})} |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| W4 | group:chararray | W3:bag{:tuple(group:chararray,W2:bag{:tuple(group:chararray,W1:bag{:tuple(group:chararray,A:bag{:tuple(f1:int,f2:int,f3:int)})})})} |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| | all | {(all, {(all, {(all, {(1, 2, 3), (8, 3, 4)})})})} |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
grunt> dump W4;
(all,{(all,{(all,{(all,{(1,2,3),(4,2,1),(8,3,4),(4,3,3)})})})})
在袋子中——W1、W2、W3、W4——哪个是内部的,哪个是外部的?