错误 [main] 2997:无法从后端错误重新创建异常:org.apache.pig.backend.executionengine.ExecException [英] ERROR [main] 2997: Unable to recreate exception from backend error: org.apache.pig.backend.executionengine.ExecException

查看:15
本文介绍了错误 [main] 2997:无法从后端错误重新创建异常:org.apache.pig.backend.executionengine.ExecException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 pig 中创建了以下脚本.我对 PIG 和 PIGLATIN 很陌生.我仍在学习如何有效地使用 PIG 脚本.

I created the the below script in pig. I am pretty new to PIG and PIGLATIN. I am still learning how to use PIG scripts efficiently.

在执行脚本时出现此错误:

Upon executing the script I got this error:

Error ERROR [main] org.apache.pig.tools.grunt.Grunt - ERROR 2997: Unable to recreate exception from backend error: org.apache.pig.backend.executionengine.ExecException

Error ERROR [main] org.apache.pig.tools.grunt.Grunt - ERROR 2997: Unable to recreate exception from backend error: org.apache.pig.backend.executionengine.ExecException

有人可以解释原因以及我如何纠正它.在 csv 文件中,除了具有整数值的 rate 列之外,我拥有所有 char 列.

Can somebody please explain the reason and how I can correct it. In the csv file I have all char columns except the rate column which has integer values.

*divs = LOAD 'output\file.csv' using PigStorage(',') AS (uniID:chararray, deal:chararray, rol: chararray,name:chararray,add:chararray,city:chararray,stat:chararray,stn:chararray,zip:chararray,country:chararray,db:chararray,sm:chararray,rate:int);
DUMP divs;
trimmed = foreach divs generate sm,uniID,rol,rate,country;
DUMP trimmed;
grpd = group trimmed by sm;
orderd = order trimmed by country;
describe trimmed;
describe grpd;
DUMP grpd;
describe orderd;
avgdiv = foreach grpd generate sm, AVG(divs.rate), SUM(divs.rate), MAX(divs.rate);
DUMP avgdiv;
store avgdiv into 'output/pigdescribe1out';
explain;*

推荐答案

您的 group 语句返回错误.您试图在分组之前聚合数据,因此出现错误.

Your group statement returns an error. You are trying to aggregate the data before grouping, hence the error.

divs = LOAD '$input' using PigStorage('^A') AS (uniID:chararray, deal:chararray, rol: chararray,name:chararray,add:chararray,city:chararray,stat:chararray,stn:chararray,zip:chararray,country:chararray,db:chararray,sm:chararray,rate:int);<br/>
DUMP divs;
trimmed = foreach divs generate sm,uniID,rol,rate,country;
DUMP trimmed;
grpd = group trimmed by sm;
orderd = order trimmed by country;
describe trimmed;
describe grpd;
DUMP grpd;
describe orderd;
avgdiv = foreach grpd generate FLATTEN(group), AVG(trimmed.rate), SUM(trimmed.rate), MAX(trimmed.rate);
DUMP avgdiv;
store avgdiv into 'data/sampledata/';
explain;

这工作得很好.

这篇关于错误 [main] 2997:无法从后端错误重新创建异常:org.apache.pig.backend.executionengine.ExecException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆