Author: hashutosh
Date: Mon Jul 11 22:20:21 2011
New Revision: 1145382

URL: http://svn.apache.org/viewvc?rev=1145382&view=rev
Log:
Both hcatalog-57 and hcatalog-59

Modified:
    incubator/hcatalog/trunk/CHANGES.txt
    incubator/hcatalog/trunk/src/java/org/apache/hcatalog/cli/HCatDriver.java
    
incubator/hcatalog/trunk/src/java/org/apache/hcatalog/cli/SemanticAnalysis/CreateTableHook.java
    
incubator/hcatalog/trunk/src/java/org/apache/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
    
incubator/hcatalog/trunk/src/java/org/apache/hcatalog/listener/NotificationListener.java
    
incubator/hcatalog/trunk/src/test/org/apache/hcatalog/cli/TestEximSemanticAnalysis.java
    incubator/hcatalog/trunk/src/test/org/apache/hcatalog/cli/TestPermsGrp.java
    
incubator/hcatalog/trunk/src/test/org/apache/hcatalog/pig/TestPermsInheritance.java

Modified: incubator/hcatalog/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/hcatalog/trunk/CHANGES.txt?rev=1145382&r1=1145381&r2=1145382&view=diff
==============================================================================
--- incubator/hcatalog/trunk/CHANGES.txt (original)
+++ incubator/hcatalog/trunk/CHANGES.txt Mon Jul 11 22:20:21 2011
@@ -46,7 +46,10 @@ Trunk (unreleased changes)
   OPTIMIZATIONS
 
   BUG FIXES
-
+    HCAT-57. Remove usage of deprecated methods (hashutosh)
+   
+    HCAT-59. Assimilate new changes in listener interface (hashutosh)
+    
     HCAT-55. HCatalog distribution missing a few required jars (gates)
 
     HCAT-52. No message is sent on message bus in case partition keys are 
uppercase (hashutosh)

Modified: 
incubator/hcatalog/trunk/src/java/org/apache/hcatalog/cli/HCatDriver.java
URL: 
http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/cli/HCatDriver.java?rev=1145382&r1=1145381&r2=1145382&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/java/org/apache/hcatalog/cli/HCatDriver.java 
(original)
+++ incubator/hcatalog/trunk/src/java/org/apache/hcatalog/cli/HCatDriver.java 
Mon Jul 11 22:20:21 2011
@@ -82,6 +82,7 @@ public class HCatDriver extends Driver {
     }
 
     FsPermission perms = FsPermission.valueOf(permsStr);
+
     if(!tblName.isEmpty()){
       Hive db = null;
       try{
@@ -116,7 +117,8 @@ public class HCatDriver extends Driver {
       }
       else{
         try{
-          Path dbPath = new Warehouse(conf).getDefaultDatabasePath(dbName);
+          Hive db = Hive.get();
+          Path dbPath = new 
Warehouse(conf).getDatabasePath(db.getDatabase(dbName));
           FileSystem fs = dbPath.getFileSystem(conf);
           if(perms != null){
             fs.setPermission(dbPath, perms);

Modified: 
incubator/hcatalog/trunk/src/java/org/apache/hcatalog/cli/SemanticAnalysis/CreateTableHook.java
URL: 
http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/cli/SemanticAnalysis/CreateTableHook.java?rev=1145382&r1=1145381&r2=1145382&view=diff
==============================================================================
--- 
incubator/hcatalog/trunk/src/java/org/apache/hcatalog/cli/SemanticAnalysis/CreateTableHook.java
 (original)
+++ 
incubator/hcatalog/trunk/src/java/org/apache/hcatalog/cli/SemanticAnalysis/CreateTableHook.java
 Mon Jul 11 22:20:21 2011
@@ -26,6 +26,7 @@ import org.apache.hadoop.conf.Configurat
 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.FieldSchema;
 import org.apache.hadoop.hive.metastore.api.MetaException;
 import org.apache.hadoop.hive.ql.exec.DDLTask;
@@ -190,7 +191,8 @@ final class CreateTableHook  extends Abs
     try {
       Warehouse wh = new Warehouse(conf);
       if (loc == null || loc.isEmpty()){
-        tblDir = 
wh.getDnsPath(wh.getDefaultTablePath(context.getHive().getCurrentDatabase(), 
tableName).getParent());
+       Hive hive = context.getHive();
+        tblDir = wh.getTablePath(hive.getDatabase(hive.getCurrentDatabase()), 
tableName).getParent();
       }
       else{
         tblDir = wh.getDnsPath(new Path(loc));

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=1145382&r1=1145381&r2=1145382&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
 Mon Jul 11 22:20:21 2011
@@ -212,7 +212,7 @@ public class HCatSemanticAnalyzer extend
       }
     } else{
       // Else, its a DB operation.
-      AuthUtils.authorize(wh.getDefaultDatabasePath(name), action, 
cntxt.getConf());
+      
AuthUtils.authorize(wh.getDatabasePath(cntxt.getHive().getDatabase(name)), 
action, cntxt.getConf());
     }
   }
 

Modified: 
incubator/hcatalog/trunk/src/java/org/apache/hcatalog/listener/NotificationListener.java
URL: 
http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/listener/NotificationListener.java?rev=1145382&r1=1145381&r2=1145382&view=diff
==============================================================================
--- 
incubator/hcatalog/trunk/src/java/org/apache/hcatalog/listener/NotificationListener.java
 (original)
+++ 
incubator/hcatalog/trunk/src/java/org/apache/hcatalog/listener/NotificationListener.java
 Mon Jul 11 22:20:21 2011
@@ -52,12 +52,14 @@ import org.apache.hadoop.hive.metastore.
 import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
 import org.apache.hadoop.hive.metastore.api.Table;
 import org.apache.hadoop.hive.metastore.events.AddPartitionEvent;
+import org.apache.hadoop.hive.metastore.events.AlterTableEvent;
 import org.apache.hadoop.hive.metastore.events.CreateDatabaseEvent;
 import org.apache.hadoop.hive.metastore.events.CreateTableEvent;
 import org.apache.hadoop.hive.metastore.events.DropDatabaseEvent;
 import org.apache.hadoop.hive.metastore.events.DropPartitionEvent;
 import org.apache.hadoop.hive.metastore.events.DropTableEvent;
 import org.apache.hadoop.hive.metastore.events.LoadPartitionDoneEvent;
+import org.apache.hadoop.hive.metastore.events.AlterPartitionEvent;
 import org.apache.hcatalog.common.HCatConstants;
 
 /**
@@ -318,4 +320,14 @@ public class NotificationListener extend
                if(lpde.getStatus())
                        
send(lpde.getPartitionName(),lpde.getTable().getParameters().get(HCatConstants.HCAT_MSGBUS_TOPIC_NAME),HCatConstants.HCAT_PARTITION_DONE_EVENT);
        }
+       
+       @Override
+       public void onAlterPartition(AlterPartitionEvent ape) throws 
MetaException{
+               //no-op
+       }
+       
+       @Override
+       public void onAlterTable(AlterTableEvent ate) throws MetaException {
+               // no-op
+       }
 }

Modified: 
incubator/hcatalog/trunk/src/test/org/apache/hcatalog/cli/TestEximSemanticAnalysis.java
URL: 
http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/test/org/apache/hcatalog/cli/TestEximSemanticAnalysis.java?rev=1145382&r1=1145381&r2=1145382&view=diff
==============================================================================
--- 
incubator/hcatalog/trunk/src/test/org/apache/hcatalog/cli/TestEximSemanticAnalysis.java
 (original)
+++ 
incubator/hcatalog/trunk/src/test/org/apache/hcatalog/cli/TestEximSemanticAnalysis.java
 Mon Jul 11 22:20:21 2011
@@ -32,6 +32,8 @@ import org.apache.hadoop.hive.conf.HiveC
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
 import org.apache.hadoop.hive.metastore.Warehouse;
 import org.apache.hadoop.hive.metastore.api.MetaException;
+import org.apache.hadoop.hive.ql.metadata.Hive;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.processors.CommandProcessorResponse;
 import org.apache.hadoop.hive.ql.session.SessionState;
 import org.apache.hcatalog.MiniCluster;
@@ -70,13 +72,13 @@ public class TestEximSemanticAnalysis ex
   protected void tearDown() throws Exception {
   }
 
-  public void testExportPerms() throws IOException, MetaException {
+  public void testExportPerms() throws IOException, MetaException, 
HiveException {
 
     hcatDriver.run("drop table junit_sem_analysis");
     CommandProcessorResponse response = hcatDriver
         .run("create table junit_sem_analysis (a int) partitioned by (b 
string) stored as RCFILE");
     assertEquals(0, response.getResponseCode());
-    Path whPath = wh.getDefaultTablePath("default", "junit_sem_analysis");
+    Path whPath = wh.getTablePath(Hive.get(hcatConf).getDatabase("default"), 
"junit_sem_analysis");
     cluster.getFileSystem().setPermission(whPath, 
FsPermission.valueOf("-rwxrwx-wx"));
     cluster.getFileSystem().setOwner(whPath, "nosuchuser", "nosuchgroup");
 
@@ -96,7 +98,7 @@ public class TestEximSemanticAnalysis ex
     }
   }
 
-  public void testImportPerms() throws IOException, MetaException {
+  public void testImportPerms() throws IOException, MetaException, 
HiveException {
 
     hcatDriver.run("drop table junit_sem_analysis");
     CommandProcessorResponse response = hcatDriver
@@ -111,7 +113,7 @@ public class TestEximSemanticAnalysis ex
     response = hcatDriver
         .run("create table junit_sem_analysis (a int) partitioned by (b 
string) stored as RCFILE");
     assertEquals(0, response.getResponseCode());
-    Path whPath = wh.getDefaultTablePath("default", "junit_sem_analysis");
+    Path whPath = wh.getTablePath(Hive.get(hcatConf).getDatabase("default"), 
"junit_sem_analysis");
     cluster.getFileSystem().setPermission(whPath, 
FsPermission.valueOf("-rwxrwxr-x"));
     cluster.getFileSystem().setOwner(whPath, "nosuchuser", "nosuchgroup");
 
@@ -132,7 +134,7 @@ public class TestEximSemanticAnalysis ex
     }
   }
 
-  public void testImportSetPermsGroup() throws IOException, MetaException {
+  public void testImportSetPermsGroup() throws IOException, MetaException, 
HiveException {
 
     hcatDriver.run("drop table junit_sem_analysis");
     hcatDriver.run("drop table junit_sem_analysis_imported");
@@ -153,7 +155,7 @@ public class TestEximSemanticAnalysis ex
         .run("import table junit_sem_analysis_imported from 
'pfile://local:9080/tmp/hcat/exports/junit_sem_analysis'");
     assertEquals(0, response.getResponseCode());
 
-    Path whPath = wh.getDefaultTablePath("default", 
"junit_sem_analysis_imported");
+    Path whPath = wh.getTablePath(Hive.get(hcatConf).getDatabase("default"), 
"junit_sem_analysis_imported");
     assertEquals(FsPermission.valueOf("-rwxrw-r--"), 
cluster.getFileSystem().getFileStatus(whPath).getPermission());
     assertEquals("nosuchgroup", 
cluster.getFileSystem().getFileStatus(whPath).getGroup());
 

Modified: 
incubator/hcatalog/trunk/src/test/org/apache/hcatalog/cli/TestPermsGrp.java
URL: 
http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/test/org/apache/hcatalog/cli/TestPermsGrp.java?rev=1145382&r1=1145381&r2=1145382&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/test/org/apache/hcatalog/cli/TestPermsGrp.java 
(original)
+++ incubator/hcatalog/trunk/src/test/org/apache/hcatalog/cli/TestPermsGrp.java 
Mon Jul 11 22:20:21 2011
@@ -30,6 +30,7 @@ import org.apache.hadoop.hive.metastore.
 import org.apache.hadoop.hive.metastore.MetaStoreUtils;
 import org.apache.hadoop.hive.metastore.Warehouse;
 import org.apache.hadoop.hive.metastore.api.AlreadyExistsException;
+import org.apache.hadoop.hive.metastore.api.Database;
 import org.apache.hadoop.hive.metastore.api.FieldSchema;
 import org.apache.hadoop.hive.metastore.api.InvalidObjectException;
 import org.apache.hadoop.hive.metastore.api.InvalidOperationException;
@@ -39,6 +40,7 @@ import org.apache.hadoop.hive.metastore.
 import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
 import org.apache.hadoop.hive.metastore.api.Table;
 import org.apache.hadoop.hive.metastore.api.Type;
+import org.apache.hadoop.hive.ql.metadata.Hive;
 import org.apache.hadoop.hive.serde.Constants;
 import org.apache.hadoop.util.StringUtils;
 import org.apache.hcatalog.ExitException;
@@ -118,7 +120,8 @@ public class TestPermsGrp extends TestCa
       // Lets first test for default permissions, this is the case when user 
specified nothing.
       Table tbl = getTable(dbName,tblName,typeName);
       msc.createTable(tbl);
-      Path dfsPath = clientWH.getDefaultTablePath(dbName, tblName);
+      Database db = Hive.get(hcatConf).getDatabase(dbName);
+      Path dfsPath = clientWH.getTablePath(db, tblName);
       cleanupTbl(dbName, tblName, typeName);
 
       // Next user did specify perms.
@@ -129,7 +132,7 @@ public class TestPermsGrp extends TestCa
         assertTrue(e instanceof ExitException);
         assertEquals(((ExitException)e).getStatus(), 0);
       }
-      dfsPath = clientWH.getDefaultTablePath(dbName, tblName);
+      dfsPath = clientWH.getTablePath(db, tblName);
       
assertTrue(dfsPath.getFileSystem(hcatConf).getFileStatus(dfsPath).getPermission().equals(FsPermission.valueOf("drwx-wx---")));
 
       cleanupTbl(dbName, tblName, typeName);
@@ -144,7 +147,7 @@ public class TestPermsGrp extends TestCa
         assertTrue(me instanceof ExitException);
       }
       // No physical dir gets created.
-      dfsPath = 
clientWH.getDefaultTablePath(MetaStoreUtils.DEFAULT_DATABASE_NAME,tblName);
+      dfsPath = clientWH.getTablePath(db,tblName);
       try{
         dfsPath.getFileSystem(hcatConf).getFileStatus(dfsPath);
         assert false;

Modified: 
incubator/hcatalog/trunk/src/test/org/apache/hcatalog/pig/TestPermsInheritance.java
URL: 
http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/test/org/apache/hcatalog/pig/TestPermsInheritance.java?rev=1145382&r1=1145381&r2=1145382&view=diff
==============================================================================
--- 
incubator/hcatalog/trunk/src/test/org/apache/hcatalog/pig/TestPermsInheritance.java
 (original)
+++ 
incubator/hcatalog/trunk/src/test/org/apache/hcatalog/pig/TestPermsInheritance.java
 Mon Jul 11 22:20:21 2011
@@ -33,6 +33,8 @@ import org.apache.hadoop.hive.metastore.
 import org.apache.hadoop.hive.metastore.api.MetaException;
 import org.apache.hadoop.hive.metastore.api.NoSuchObjectException;
 import org.apache.hadoop.hive.metastore.api.UnknownTableException;
+import org.apache.hadoop.hive.ql.metadata.Hive;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hcatalog.ExitException;
 import org.apache.hcatalog.NoExitSecurityManager;
 import org.apache.hcatalog.cli.HCatCli;
@@ -70,7 +72,7 @@ public class TestPermsInheritance extend
 
   private final HiveConf conf = new HiveConf(this.getClass());
 
-  public void testNoPartTbl() throws IOException, MetaException, 
UnknownTableException, TException, NoSuchObjectException{
+  public void testNoPartTbl() throws IOException, MetaException, 
UnknownTableException, TException, NoSuchObjectException, HiveException{
 
     try{
       HCatCli.main(new String[]{"-e","create table testNoPartTbl (line string) 
stored as RCFILE", "-p","rwx-wx---"});
@@ -80,7 +82,7 @@ public class TestPermsInheritance extend
       assertEquals(((ExitException)e).getStatus(), 0);
     }
     Warehouse wh = new Warehouse(conf);
-    Path dfsPath = 
wh.getDefaultTablePath(MetaStoreUtils.DEFAULT_DATABASE_NAME, "testNoPartTbl");
+    Path dfsPath = 
wh.getTablePath(Hive.get(conf).getDatabase(MetaStoreUtils.DEFAULT_DATABASE_NAME),
 "testNoPartTbl");
     FileSystem fs = dfsPath.getFileSystem(conf);
     
assertEquals(fs.getFileStatus(dfsPath).getPermission(),FsPermission.valueOf("drwx-wx---"));
 
@@ -101,7 +103,7 @@ public class TestPermsInheritance extend
       assertEquals(((ExitException)e).getStatus(), 0);
     }
 
-    dfsPath = wh.getDefaultTablePath(MetaStoreUtils.DEFAULT_DATABASE_NAME, 
"testPartTbl");
+    dfsPath = 
wh.getTablePath(Hive.get(conf).getDatabase(MetaStoreUtils.DEFAULT_DATABASE_NAME),
 "testPartTbl");
     
assertEquals(fs.getFileStatus(dfsPath).getPermission(),FsPermission.valueOf("drwx-wx--x"));
 
     pig.setBatchOn();


Reply via email to