我正在尝试使用CSVExcelStorage()存储Pig对象。我使用的猪脚本是:
REGISTER /usr/local/pig/lib/piggybank.jar;
a = LOAD '/input/someText.txt' USING org.apache.pig.piggybank.storage.CSVExcelStorage(',');
dump a;
b = FOREACH a GENERATE $1,$2;
dump b;
STORE b into '/user/username/b_output' USING org.apache.pig.piggybank.storage.CSVExcelStorage();
dump a给我这个结果
(abcd,efgh,ijkl)
(mnop,qrst,uvwx)
dump b给我这个结果
(efgh,ijkl)
(qrst,uvwx)
但商店给了我这个错误
ERROR org.apache.pig.tools.pigstats.SimplePigStats - ERROR 2997: Unable to recreate exception from backed error: Error: org.apache.pig.data.Tuple.isNull()Z
Message: Job failed! Error - # of failed Map Tasks exceeded allowed limit. FailedCount: 1. LastFailedTask: task_201505250503_0003_m_000000
当我通过浏览器访问JobTracker页面查看错误时,发现以下错误
Error: org.apache.pig.data.Tuple.isNull()Z
我做错了什么?
答案 0 :(得分:0)
我的工作代码:
<强>输入:强>
1,name1,addr2,atos
2,name2,addr2,barclays
3,name3,addr3,accenture
<强>代码:强>
REGISTER piggybank.jar;
define CSVExcelStorage org.apache.pig.piggybank.storage.CSVExcelStorage();
a = LOAD '/user/input/data_test3.txt' USING CSVExcelStorage(',');
--dump a;
b = FOREACH a GENERATE $1,$2;
--dump b;
STORE b into '/user/input/output' USING CSVExcelStorage();
<强>输出:强>
name1,addr2
name2,addr2
name3,addr3