incubator-hcatalog-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1204071 - in /incubator/hcatalog/trunk: CHANGES.txt src/java/org/apache/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java src/test/org/apache/hcatalog/cli/TestSemanticAnalysis.java
Date Sat, 19 Nov 2011 20:46:23 GMT
Author: hashutosh
Date: Sat Nov 19 20:46:23 2011
New Revision: 1204071

URL: http://svn.apache.org/viewvc?rev=1204071&view=rev
Log:
HCATALOG-124: null pointer execption on 'use no_such_db' (hashutosh)

Modified:
    incubator/hcatalog/trunk/CHANGES.txt
    incubator/hcatalog/trunk/src/java/org/apache/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
    incubator/hcatalog/trunk/src/test/org/apache/hcatalog/cli/TestSemanticAnalysis.java

Modified: incubator/hcatalog/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/CHANGES.txt?rev=1204071&r1=1204070&r2=1204071&view=diff
==============================================================================
--- incubator/hcatalog/trunk/CHANGES.txt (original)
+++ incubator/hcatalog/trunk/CHANGES.txt Sat Nov 19 20:46:23 2011
@@ -79,6 +79,8 @@ Trunk (unreleased changes)
   OPTIMIZATIONS
 
   BUG FIXES
+  HCAT-124. null pointer execption on 'use no_such_db' (hashutosh)
+
   HCAT-125. HCat doesn't support hive's describe database DDL (hashutosh)
 
   HCAT-159. Build broken by recent Hive changes that move around jar files  part-2 (thw via
hashutosh)

Modified: incubator/hcatalog/trunk/src/java/org/apache/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java?rev=1204071&r1=1204070&r2=1204071&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/java/org/apache/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
(original)
+++ incubator/hcatalog/trunk/src/java/org/apache/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
Sat Nov 19 20:46:23 2011
@@ -25,6 +25,7 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.permission.FsAction;
 import org.apache.hadoop.hive.metastore.Warehouse;
+import org.apache.hadoop.hive.metastore.api.Database;
 import org.apache.hadoop.hive.metastore.api.MetaException;
 import org.apache.hadoop.hive.ql.exec.Task;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
@@ -212,7 +213,12 @@ public class HCatSemanticAnalyzer extend
       }
     } else{
       // Else, its a DB operation.
-      AuthUtils.authorize(wh.getDatabasePath(cntxt.getHive().getDatabase(name)), action,
cntxt.getConf());
+    	Database db = cntxt.getHive().getDatabase(name); 
+    	if(null == db){
+    		// Database doesn't exist, nothing to authorize
+    		return;
+    	}
+      AuthUtils.authorize(wh.getDatabasePath(db), action, cntxt.getConf());
     }
   }
 

Modified: incubator/hcatalog/trunk/src/test/org/apache/hcatalog/cli/TestSemanticAnalysis.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/test/org/apache/hcatalog/cli/TestSemanticAnalysis.java?rev=1204071&r1=1204070&r2=1204071&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/test/org/apache/hcatalog/cli/TestSemanticAnalysis.java (original)
+++ incubator/hcatalog/trunk/src/test/org/apache/hcatalog/cli/TestSemanticAnalysis.java Sat
Nov 19 20:46:23 2011
@@ -126,6 +126,11 @@ public class TestSemanticAnalysis extend
     hcatDriver.run("drop table junit_sem_analysis");
   }
 
+
+  public void testUsNonExistentDB() throws CommandNeedRetryException {
+	assertEquals(9, hcatDriver.run("use no_such_db").getResponseCode());  
+  }
+  
   public void testDatabaseOperations() throws MetaException, CommandNeedRetryException {
 
     List<String> dbs = msc.getAllDatabases();



Mime
View raw message