Index: ql/src/java/org/apache/hadoop/hive/ql/exec/MapRedTask.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/exec/MapRedTask.java (revision 1164711) +++ ql/src/java/org/apache/hadoop/hive/ql/exec/MapRedTask.java (working copy) @@ -185,23 +185,23 @@ String workDir = (new File(".")).getCanonicalPath(); String files = getResourceFiles(conf, SessionState.ResourceType.FILE); - if (!files.isEmpty()) { - cmdLine = cmdLine + " -files " + files; - + String archives = getResourceFiles(conf, SessionState.ResourceType.ARCHIVE); + if (!files.isEmpty() || !archives.isEmpty()) { workDir = (new Path(ctx.getLocalTmpFileURI())).toUri().getPath(); if (! (new File(workDir)).mkdir()) { throw new IOException ("Cannot create tmp working dir: " + workDir); } - for (String f: StringUtils.split(files, ',')) { - Path p = new Path(f); - String target = p.toUri().getPath(); - String link = workDir + Path.SEPARATOR + p.getName(); - if (FileUtil.symLink(target, link) != 0) { - throw new IOException ("Cannot link to added file: " + target + " from: " + link); - } + if (!files.isEmpty()) { + cmdLine = cmdLine + " -files " + files; + linkFiles(files, workDir); } + + if (!archives.isEmpty()) { + cmdLine = cmdLine + " -archives " + archives; + linkFiles(archives, workDir); + } } LOG.info("Executing: " + cmdLine); @@ -488,4 +488,15 @@ return null; } + + private void linkFiles(String files, String workDir) throws IOException { + for (String f: StringUtils.split(files, ',')) { + Path p = new Path(f); + String target = p.toUri().getPath(); + String link = workDir + Path.SEPARATOR + p.getName(); + if (FileUtil.symLink(target, link) != 0) { + throw new IOException ("Cannot link to added file: " + target + " from: " + link); + } + } + } }