Insert overwrite query Failed with exception Unable to move source
Category : Hive
If you have explicitly setup hive.exec.stagingdir to some location like /tmp/ or some other location then whenever you will run insert overwrite statment then you will get following error.
ERROR exec.Task (SessionState.java:printError(989)) – Failed with exception Unable to move source hdfs://clustername/apps/finance/nest/nest_audit_log_final/
.hive-staging_hive_2017-12-12_19-15-30_008_33149322272174981-1/-ext-10000 to
destination hdfs://clustername/apps/finance/nest/nest_audit_log_final
Example:
INSERT OVERWRITE TABLE nest.nest_audit_log_final
SELECT
project_name
, application
, module_seq_num
, module_name
, script_seq_num
, script_name
, run_session_id
, load_ts
, max_posted_date
, currency
, processor
, load_date
FROM nest.nest_audit_log_final;
Then you will get following error:
INFO common.FileUtils (FileUtils.java:mkdir(519)) - Creating directory if it doesn't exist: hdfs://clustername/apps/finance/nest/nest_audit_log_final 2017-12-12 19:21:42,508 ERROR hdfs.KeyProviderCache (KeyProviderCache.java:createKeyProviderURI(87)) - Could not find uri with key [dfs.encryption.key.provider.uri] to create a keyProvider !! 2017-12-12 19:21:42,525 ERROR exec.Task (SessionState.java:printError(989)) - Failed with exception Unable to move source hdfs://clustername/apps/finance/nest/nest_audit_log_final/ .hive-staging_hive_2017-12-12_19-15-30_008_33149322272174981-1/-ext-10000 to destination hdfs://clustername/apps/finance/nest/nest_audit_log_final org.apache.hadoop.hive.ql.metadata.HiveException: Unable to move source hdfs://clustername/apps/finance/nest/nest_audit_log_final/ .hive-staging_hive_2017-12-12_19-15-30_008_33149322272174981-1/-ext-10000 to destination hdfs://clustername/apps/finance/nest/nest_audit_log_final at org.apache.hadoop.hive.ql.metadata.Hive.moveFile(Hive.java:2900) at org.apache.hadoop.hive.ql.metadata.Hive.replaceFiles(Hive.java:3140) at org.apache.hadoop.hive.ql.metadata.Hive.loadTable(Hive.java:1727) at org.apache.hadoop.hive.ql.exec.MoveTask.execute(MoveTask.java:353) at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:160) at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:89) at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1745) at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1491) at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1289) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1156) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1146) at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:217) at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:169) at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:380) at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:315) at org.apache.hadoop.hive.cli.CliDriver.processReader(CliDriver.java:413) at org.apache.hadoop.hive.cli.CliDriver.processFile(CliDriver.java:429) at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:718) at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:685) at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:625) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.util.RunJar.run(RunJar.java:233) at org.apache.hadoop.util.RunJar.main(RunJar.java:148) Caused by: java.io.IOException: rename for src path: hdfs://clustername/apps/finance/nest/nest_audit_log_final/ .hive-staging_hive_2017-12-12_19-15-30_008_33149322272174981-1/-ext-10000/000000_0 to dest:hdfs://clustername/apps/finance/nest/nest_audit_log_final returned false at org.apache.hadoop.hive.ql.metadata.Hive.moveFile(Hive.java:2849) Root Cause: It is because of a bug (HIVE-17063).
Workaround:
set hive.exec.stagingdir=.hive-staging;
1 Comment
Vishal Amin
February 26, 2020 at 8:47 pmKind of a random question, but do you have any experience with oil/gas data management? https://www.bisok.com/industry/digital-oilfield/ They claim some pretty nice abilities, but haven’t heard of them before. I believe they are kind of new. Looking for someone with experience. Thanks