在Apache Pig中为Tuple创建模式

时间:2015-04-05 05:59:23

标签: hadoop apache-pig bigdata

如何在加载关系时为以下元组数据创建Pig模式?

]$ cat data

(3,8,9) (4,5,6)

(1,4,7) (3,7,5)

(2,5,8) (9,5,8)

我在本地模式下尝试了以下语句

A = LOAD '/home/cloudera/data' AS (t1:tuple(t1a:int,t1b:int,t1c:int),t2:tuple(t2a:int,t2b:int,t2c:int));

如果我转储数据,我期待结果

DUMP A;

((3,8,9),(4,5,6))

((1,4,7),(3,7,5))

((2,5,8),(9,5,8))

但我得到的是,

((3,8,9),)

((1,4,7),)

((2,5,8),)

我正在使用Apache Pig版本0.11.0-cdh4.7.0

1 个答案:

答案 0 :(得分:1)

接下来的工作:

A = load  '$input' using PigStorage(' ') AS (t1:tuple(t1a:int,t1b:int,t1c:int),t2:tuple(t2a:int,t2b:int,t2c:int));
describe A;
dump A;

转储:

((3,8,9),(4,5,6))
((1,4,7),(3,7,5))
((2,5,8),(9,5,8))