SemanticException [错误10043]:应指定列列表或自定义序列化程序

时间:2013-12-19 10:26:05

标签: sql join hadoop hive hiveql

我写了一个HiveQL代码,用于查找yes响应的计数以及它们的累积计数。

ADD JAR ${nameNode}/user/user1/input-data/BDEDefault/hive-data/jar/BDEHiveAvroSerde-0.1.0.jar;
ADD JAR ${nameNode}/user/user1/input-data/BDEDefault/hive-data/jar/openx-hive-json-serde.jar;
ADD JAR ${nameNode}/user/user1/input-data/BDEDefault/hive-data/jar/BDEHiveXMLSerde-0.1.0.jar;
ADD JAR ${nameNode}/user/user1/input-data/BDEDefault/hive-data/jar/opencsv-2.0.jar;
ADD JAR ${nameNode}/user/user1/input-data/BDEDefault/hive-data/jar/hive-csv-serde.jar;

DROP TABLE IF EXISTS tmp_LRchart1;

CREATE TABLE  tmp_LRchart1
AS
SELECT R.campid, R.CampNum, R.Count, R.Legend from
(
    Select campid, Cast(campid as int) as CampNum, count(emailres) as Count, 'Email Response Count' as Legend from campdataderivedcol where emailres='Y' group by campid Order By CampNum
    Union All
    Select campid, Cast(campid as int) as CampNum, count(dmailres) as Count, 'Dmail Response Count' as Legend from campdataderivedcol where dmailres='Y' group by campid Order By CampNum
    Union All
    Select campid, Cast(campid as int) as CampNum, count(catres) as Count, 'Catalog Response Count' as Legend from campdataderivedcol where catres='Y' group by campid Order By CampNum
    Union All
    Select campid, Cast(campid as int) as CampNum, count(mobres) as Count, 'Mobile Response Count' as Legend from campdataderivedcol where mobres='Y' group by campid Order By CampNum
    Union All
    Select campid, Cast(campid as int) as CampNum,count(socres) as Count, 'Social Response Count' as Legend from campdataderivedcol where socres='Y' group by campid Order By CampNum
    Union All
    Select campid, Cast(campid as int) as CampNum, count(webres) as Count, 'Web Ads Response Count' as Legend from campdataderivedcol where webres='Y' group by campid Order By CampNum
)R;

DROP TABLE IF EXISTS LR_Charts;

CREATE TABLE IF NOT EXISTS LR_Charts;

INSERT INTO TABLE LR_Charts 
    select campid,CampNum,Count,Legend from tmp_LRchart1 Order By CampNum;

ALTER TABLE LR_Charts ADD COLUMNS (CountCumm  INT);

Select tmp_LRchart1.campid, tmp_LRchart1.Count, SUM(LR_Charts.Count) as
 LR_Charts.CountCumm from tmp_LRchart1, LR_Charts where tmp_LRchart1.campid >= LR_Charts.campid group by tmp_LRchart1.campid order by tmp_LRchart1.campid;

DROP TABLE IF EXISTS LR_STACK;

CREATE TABLE IF NOT EXIST LR_STACK
ROW FORMAT SERDE 'com.infosys.bdh.hive.serde.avro.BDHAvroSerDe'
WITH SERDEPROPERTIES ('avro.schema.literal'='${outputSchema}')
STORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat' 
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat' LOCATION '${OUTPUT}';

INSERT INTO TABLE LR_STACK
    select campid,CampNum,Count,Legend,CountCumm from LR_Charts Order By CampNum;

它使用不同的环境,因此必须包含Jar文件,并且LR_STACK的一部分是正确的(通过单独运行该部分来检查它)。 tmp_LRcharts1也被创建并显示正确的输出。 只是创建LR_Charts(使用Alter表)的部分和用于计算累积计数(CummCount)的查询正在抛出错误。

基本上,我在查询文件的这一部分做错了什么:

INSERT INTO TABLE LR_Charts 
select campid,CampNum,Count,Legend from tmp_LRchart1 Order By CampNum;

ALTER TABLE LR_Charts ADD COLUMNS (CountCumm  INT);

Select tmp_LRchart1.campid, tmp_LRchart1.Count, SUM(LR_Charts.Count) as LR_Charts.CountCumm from tmp_LRchart1, LR_Charts where tmp_LRchart1.campid >= LR_Charts.campid group by tmp_LRchart1.campid order by tmp_LRchart1.campid;

请帮助。

0 个答案:

没有答案