猪:输出1列

时间:2014-12-06 16:19:39

标签: java apache-pig

说我有一个数据文件:

abc,def,ghi
jkl,mno,pqr
stu,vwx,yz

如何只输出1列,以便我接下来?

abc
jkl
stu

这是我的想法:

A = load 'data'  AS (c1,c2,c3);
dump A.c1

我收到此错误:

2014-12-06 17:14:19,424 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1000: Error during parsing. Encountered " <PATH> "data.c1 "" at line 2, column 6.
Was expecting one of:
    <EOF> 
    "cat" ...
    "clear" ...
    "fs" ...
    "sh" ...
    "cd" ...
    "cp" ...
    "copyFromLocal" ...

1 个答案:

答案 0 :(得分:2)

你能这样试试吗?

A = LOAD 'data' USING PigStorage(',') AS (c1,c2,c3);
B = FOREACH A GENERATE c1;
DUMP B;

<强>输出:

(abc)
(jkl)
(stu)