You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by br...@apache.org on 2015/01/08 18:07:55 UTC

svn commit: r1650334 - /hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java

Author: brock
Date: Thu Jan  8 17:07:55 2015
New Revision: 1650334

URL: http://svn.apache.org/r1650334
Log:
HIVE-9308 - Refine the logic for the isSub method to support local file in HIVE.java (Ferdinand Xu vi Brock)

Modified:
    hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java

Modified: hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java?rev=1650334&r1=1650333&r2=1650334&view=diff
==============================================================================
--- hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java (original)
+++ hive/branches/HIVE-8065/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java Thu Jan  8 17:07:55 2015
@@ -2363,19 +2363,11 @@ private void constructOneLBLocationMap(F
     if (srcf == null) {
       return false;
     }
-    URI srcfUri = srcf.toUri();
-    // In query test, the ware house is using the local file system.
-    boolean isInTest = Boolean.valueOf(HiveConf.getBoolVar(fs.getConf(), ConfVars.HIVE_IN_TEST));
-    if (isInTest) {
-      return FileUtils.isSubDir(srcf, destf, fs);
-    } else {
-      // If the source file is in the file schema, it can not be the subdirectory of a HDFS path
-      if (srcfUri != null && srcfUri.isAbsolute() && !srcfUri.getScheme().equals("hdfs")) {
-        return false;
-      } else {
-        return FileUtils.isSubDir(srcf, destf, fs);
-      }
-    }
+    Path currentWorkingDir = fs.getWorkingDirectory();
+    String fullF1 = srcf.makeQualified(srcf.toUri(), currentWorkingDir).toString();
+    String fullF2 = destf.makeQualified(destf.toUri(), currentWorkingDir).toString();
+    LOG.debug("The source path is " + fullF1 + " and destination path is " + fullF2);
+    return fullF1.startsWith(fullF2);
   }
 
   //it is assumed that parent directory of the destf should already exist when this