本文介绍了错误[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:

有人可以解释一下原因以及我如何纠正它.在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;*

推荐答案

您的组语句返回错误.您正在尝试在分组之前汇总数据,因此会出现错误.

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 08:25