diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java index 4c9acce..78e3e7a 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java @@ -2653,9 +2653,6 @@ private static void copyFiles(final HiveConf conf, final FileSystem destFs, destPath = mvFile(conf, srcP, destPath, isSrcLocal, srcFs, destFs, name, filetype); } - if (inheritPerms) { - ShimLoader.getHadoopShims().setFullFileStatus(conf, fullDestStatus, destFs, destf); - } if (null != newFiles) { newFiles.add(destPath); } @@ -2675,6 +2672,14 @@ private static void copyFiles(final HiveConf conf, final FileSystem destFs, throw new HiveException(e.getCause()); } } + if (inheritPerms) { + try { + ShimLoader.getHadoopShims().setFullFileStatus(conf, fullDestStatus, destFs, destf); + } catch (IOException e) { + LOG.error("Failed to set full file status on " + destf); + throw new HiveException(e); + } + } } private static boolean destExists(List> result, Path proposed) {