You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2013/10/13 18:24:24 UTC

svn commit: r1531706 - /hive/trunk/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java

Author: hashutosh
Date: Sun Oct 13 16:24:23 2013
New Revision: 1531706

URL: http://svn.apache.org/r1531706
Log:
HIVE-5496 : hcat -e drop database if exists fails on authorizing non-existent null db (Sushanth Sowmyan via Ashutosh Chauhan)

Modified:
    hive/trunk/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java

Modified: hive/trunk/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/trunk/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java?rev=1531706&r1=1531705&r2=1531706&view=diff
==============================================================================
--- hive/trunk/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java (original)
+++ hive/trunk/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java Sun Oct 13 16:24:23 2013
@@ -271,7 +271,11 @@ public class HCatSemanticAnalyzer extend
     DropDatabaseDesc dropDb = work.getDropDatabaseDesc();
     if (dropDb != null) {
       Database db = cntxt.getHive().getDatabase(dropDb.getDatabaseName());
-      authorize(db, Privilege.DROP);
+      if (db != null){
+        // if above returned a null, then the db does not exist - probably a
+        // "drop database if exists" clause - don't try to authorize then.
+        authorize(db, Privilege.DROP);
+      }
     }
 
     DescDatabaseDesc descDb = work.getDescDatabaseDesc();