TomG
TomG

Reputation: 291

Hive unable to move query results to a folder

I have written a select query in hive to move data to a particular folder. But I am getting an error. Please help.

Moving data to local directory /Dataproviders/DataSurgery/Order/out/jul24msngtxn/negtxns Failed with exception Unable to move source hdfs://mycluster/tmp/hive/sshuser/253d3089-fcc0-4656-82ca-ccbe893196ed/hive_2018-08-16_06-58-29_220_388527949811395742-1/-mr-10000 to destination /Dataproviders/DataSurgery/Order/out/jul24msngtxn/negtxns FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask

    INSERT OVERWRITE LOCAL DIRECTORY '/Dataproviders/DataSurgery/Order/out/jul24msngtxn/negtxns/'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\034'
STORED AS TEXTFILE
select * from sourcetable;

I have given full permission to the following folders. But still issue exists

hdfs dfs -chmod 777 /tmp/hive
hdfs dfs -chmod -R 777 /Dataproviders/DataSurgery/

Upvotes: 0

Views: 360

Answers (1)

TomG
TomG

Reputation: 291

I made a terrible mistake. The keyword LOCAL should not be present to write into an hdfs directory. I removed that and query worked fine. Please find the correct query.

INSERT OVERWRITE DIRECTORY '/Dataproviders/DataSurgery/Order/out/jul24msngtxn/negtxns/'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\034'
STORED AS TEXTFILE
select * from sourcetable;

Upvotes: 1

Related Questions