hadoop-hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhr...@apache.org
Subject svn commit: r735172 - in /hadoop/hive/trunk: CHANGES.txt metastore/src/java/org/apache/hadoop/hive/metastore/Warehouse.java ql/src/java/org/apache/hadoop/hive/ql/parse/LoadSemanticAnalyzer.java
Date Fri, 16 Jan 2009 22:45:38 GMT
Author: dhruba
Date: Fri Jan 16 14:45:38 2009
New Revision: 735172

URL: http://svn.apache.org/viewvc?rev=735172&view=rev
Log:
HIVE-232. Metastore.warehouse configuration should use inherited 
hadoop configuration (Prasad Chakka via dhruba)


Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/Warehouse.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/LoadSemanticAnalyzer.java

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=735172&r1=735171&r2=735172&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Fri Jan 16 14:45:38 2009
@@ -205,3 +205,6 @@
 
     HIVE-230.  Fix for a Null Pointer Exception that occured while loading a 
     table from a query that returns empty data.  (Prasad Chakka via dhruba)
+
+    HIVE-232. Metastore.warehouse configuration should use inherited 
+    hadoop configuration (Prasad Chakka via dhruba)

Modified: hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/Warehouse.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/Warehouse.java?rev=735172&r1=735171&r2=735172&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/Warehouse.java (original)
+++ hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/Warehouse.java Fri
Jan 16 14:45:38 2009
@@ -20,6 +20,7 @@
 
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.net.URI;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -52,6 +53,12 @@
       throw new MetaException(HiveConf.ConfVars.METASTOREWAREHOUSE.varname + " is not set
in the config or blank");
     }
     whRoot = new Path(whRootString);
+    URI uri = whRoot.toUri();
+    // if the METASTOREWAREHOUSE value doesn't have schema and authority specified then inherit
+    // from fs.default.name in hadoop-site.xml 
+    if ((uri.getScheme() == null) && (uri.getAuthority() == null)) {
+      whRoot = new Path(HiveConf.getVar(conf, HiveConf.ConfVars.HADOOPFS), whRootString);
+    }
     try {
       fs  = whRoot.getFileSystem(conf);
     } catch (IOException e) {

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/LoadSemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/LoadSemanticAnalyzer.java?rev=735172&r1=735171&r2=735172&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/LoadSemanticAnalyzer.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/LoadSemanticAnalyzer.java
Fri Jan 16 14:45:38 2009
@@ -62,8 +62,6 @@
   }
 
   private URI initializeFromURI(String fromPath) throws IOException {
-    // TODO: support hdfs relative path names by defaulting to /user/<user.name>
-
     Path p = new Path(fromPath);
     URI fromURI = p.toUri();
 
@@ -74,16 +72,17 @@
       if(isLocal) {
         if(!fromPath.startsWith("/")) {
           // generate absolute path relative to current directory
-          p = new Path(new Path("file://"+System.getProperty("user.dir")), fromPath);
-        } else {
-          p = new Path("file://"+fromPath);
+          p = new Path(System.getProperty("user.dir"), fromPath);
         }
-        fromURI = p.toUri();
         fromScheme = "file";
+      } else {
+        if(!fromPath.startsWith("/") && StringUtils.isEmpty(fromURI.getAuthority())
) {
+          // generate absolute path relative to current directory
+          p = new Path(new Path("/user/"+System.getProperty("user.name")), fromPath);
+        }
       }
     }
 
-
     fs = FileSystem.get(fromURI, conf);
     String fromAuthority = null;
 
@@ -100,7 +99,7 @@
     }
 
     try {
-      fromURI = new URI(fromScheme, fromAuthority, fromURI.getPath(), null, null);
+      fromURI = new URI(fromScheme, fromAuthority, p.toString(), null, null);
     } catch (URISyntaxException e) {
       throw new RuntimeException (e);
     }



Mime
View raw message