我要装货 .csv
将文件作为orc文件保存到配置单元表中。我看到一篇帖子,其中提出了解决问题的方法,我执行了以下查询:
1) 将数据作为文本文件创建并加载到临时表中:
CREATE TABLE IF NOT EXISTS CrimesData( ID int, Case_Number int, CrimeDate string, Block string , IUCR string,Primary_Type string, Description string, Location_Description string, Arrest string, Domestic string, Beat int, District int, Ward int, Community_Area int, FBI_Code string, X_Coordinate int, Y_Coordinate int, Year int, Updated_On string, Latitude decimal(10,10), Longitude decimal(10,10), CrimeLocation string)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n'
tblproperties("skip.header.line.count"="1")
LOAD DATA LOCAL INPATH '/home/cloudera/Documents/CrimesData.csv' INTO TABLE CrimesData
2) 创建新表并指定orc数据作为源:
CREATE TABLE IF NOT EXISTS CrimesDataORC( ID int, Case_Number int, CrimeDate string, Block string , IUCR string,Primary_Type string, Description string, Location_Description string, Arrest string, Domestic string, Beat int, District int, Ward int, Community_Area int, FBI_Code string, X_Coordinate int, Y_Coordinate int, Year int, Updated_On string, Latitude decimal(10,10), Longitude decimal(10,10), CrimeLocation string)
STORED AS ORC;
3) 从临时表向新表中插入数据:
INSERT INTO TABLE CrimesDataORC SELECT * FROM CrimesData;
前两个步骤执行时没有任何错误,但步骤3抛出以下错误:
处理语句时出错:失败:执行错误,从org.apache.hadoop.hive.ql.exec.mr.mapredtask返回代码2
我正在cloudera manager quickstart vm5.8上运行上述查询。
不确定哪里出错,因为同一数据库中另一个表的类似步骤按预期工作。
1条答案
按热度按时间egdjgwm81#
这可能是一种与结构不符的数据。尝试在select语句中设置一些where条件来检查而不是插入所有数据