gpt4 book ai didi

java - pig : Output 1 column

转载 作者:行者123 更新时间:2023-11-30 03:38:10 27 4
gpt4 key购买 nike

假设我有一个数据文件:

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" ...

最佳答案

你可以这样尝试吗?

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

输出:

(abc)
(jkl)
(stu)

关于java - pig : Output 1 column,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27333660/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com