Index: ql/src/java/org/apache/hadoop/hive/ql/plan/ConditionalResolverCommonJoin.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/plan/ConditionalResolverCommonJoin.java (revision 1552435) +++ ql/src/java/org/apache/hadoop/hive/ql/plan/ConditionalResolverCommonJoin.java (working copy) @@ -48,8 +48,8 @@ HashMap aliasToKnownSize; private Task commonJoinTask; - private String localTmpDir; - private String hdfsTmpDir; + private Path localTmpDir; + private Path hdfsTmpDir; public ConditionalResolverCommonJoinCtx() { } @@ -86,19 +86,19 @@ this.pathToAliases = pathToAliases; } - public String getLocalTmpDir() { + public Path getLocalTmpDir() { return localTmpDir; } - public void setLocalTmpDir(String localTmpDir) { + public void setLocalTmpDir(Path localTmpDir) { this.localTmpDir = localTmpDir; } - public String getHdfsTmpDir() { + public Path getHdfsTmpDir() { return hdfsTmpDir; } - public void setHdfsTmpDir(String hdfsTmpDir) { + public void setHdfsTmpDir(Path hdfsTmpDir) { this.hdfsTmpDir = hdfsTmpDir; } } @@ -155,8 +155,8 @@ private String resolveMapJoinTask( HashMap> pathToAliases, HashMap> aliasToTask, - HashMap aliasToKnownSize, String hdfsTmpDir, - String localTmpDir, HiveConf conf) { + HashMap aliasToKnownSize, Path hdfsTmpDir, + Path localTmpDir, HiveConf conf) { String bigTableFileAlias = null; long smallTablesFileSizeSum = 0; @@ -175,7 +175,7 @@ .entrySet()) { String p = oneEntry.getKey(); // this path is intermediate data - if (p.startsWith(hdfsTmpDir) || p.startsWith(localTmpDir)) { + if (p.startsWith(hdfsTmpDir.toString()) || p.startsWith(localTmpDir.toString())) { ArrayList aliasArray = oneEntry.getValue(); if (aliasArray.size() <= 0) { continue; Index: ql/src/java/org/apache/hadoop/hive/ql/Context.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/Context.java (revision 1552435) +++ ql/src/java/org/apache/hadoop/hive/ql/Context.java (working copy) @@ -78,7 +78,7 @@ private final String scratchDirPermission; // Keeps track of scratch directories created for different scheme/authority - private final Map fsScratchDirs = new HashMap(); + private final Map fsScratchDirs = new HashMap(); private final Configuration conf; protected int pathid = 10000; @@ -189,11 +189,11 @@ * @param mkdir create the directory if true * @param scratchDir path of tmp directory */ - private String getScratchDir(String scheme, String authority, + private Path getScratchDir(String scheme, String authority, boolean mkdir, String scratchDir) { String fileSystem = scheme + ":" + authority; - String dir = fsScratchDirs.get(fileSystem + "-" + TaskRunner.getTaskRunnerID()); + Path dir = fsScratchDirs.get(fileSystem + "-" + TaskRunner.getTaskRunnerID()); if (dir == null) { Path dirPath = new Path(scheme, authority, @@ -216,7 +216,7 @@ throw new RuntimeException (e); } } - dir = dirPath.toString(); + dir = dirPath; fsScratchDirs.put(fileSystem + "-" + TaskRunner.getTaskRunnerID(), dir); } @@ -227,7 +227,7 @@ /** * Create a local scratch directory on demand and return it. */ - public String getLocalScratchDir(boolean mkdir) { + public Path getLocalScratchDir(boolean mkdir) { try { FileSystem fs = FileSystem.getLocal(conf); URI uri = fs.getUri(); @@ -243,7 +243,7 @@ * Create a map-reduce scratch directory on demand and return it. * */ - public String getMRScratchDir() { + public Path getMRScratchDir() { // if we are executing entirely on the client side - then // just (re)use the local scratch directory @@ -254,7 +254,7 @@ try { Path dir = FileUtils.makeQualified(nonLocalScratchPath, conf); URI uri = dir.toUri(); - String newScratchDir = getScratchDir(uri.getScheme(), uri.getAuthority(), + Path newScratchDir = getScratchDir(uri.getScheme(), uri.getAuthority(), !explain, uri.getPath()); LOG.info("New scratch dir is " + newScratchDir); return newScratchDir; @@ -266,7 +266,7 @@ } } - private String getExternalScratchDir(URI extURI) { + private Path getExternalScratchDir(URI extURI) { return getScratchDir(extURI.getScheme(), extURI.getAuthority(), !explain, nonLocalScratchPath.toUri().getPath()); } @@ -275,9 +275,9 @@ * Remove any created scratch directories. */ private void removeScratchDir() { - for (Map.Entry entry : fsScratchDirs.entrySet()) { + for (Map.Entry entry : fsScratchDirs.entrySet()) { try { - Path p = new Path(entry.getValue()); + Path p = entry.getValue(); p.getFileSystem(conf).delete(p, true); } catch (Exception e) { LOG.warn("Error Removing Scratch: " @@ -328,7 +328,7 @@ */ public String localizeMRTmpFileURI(String originalURI) { Path o = new Path(originalURI); - Path mrbase = new Path(getMRScratchDir()); + Path mrbase = getMRScratchDir(); URI relURI = mrbase.toUri().relativize(o.toUri()); if (relURI.equals(o.toUri())) {