我想将.csv
文件作为 ORC 文件加载到 Hive 表中。我遇到了一篇帖子
,该帖子建议解决我执行以下查询的问题:
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 步抛出以下错误:
处理语句时出错:FAILED:执行错误,从 org.apache.hadoop.hive.ql.exec.mr.MapRedTask 返回代码 2
我在 Cloudera Manager Quickstart VM 5.8 上运行上述查询。
不确定我哪里出错了,因为同一数据库中另一个表的类似步骤按预期工作。