hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1412750 - in /hive/branches/branch-0.9/metastore/src: java/org/apache/hadoop/hive/metastore/ java/org/apache/hadoop/hive/metastore/events/ test/org/apache/hadoop/hive/metastore/
Date Fri, 23 Nov 2012 04:50:23 GMT
Author: hashutosh
Date: Fri Nov 23 04:50:22 2012
New Revision: 1412750

URL: http://svn.apache.org/viewvc?rev=1412750&view=rev
Log:
HIVE-3680 : Include Table information in Hive's AddPartitionEvent. (Mithun RadhaKrishnan via
Ashutosh Chauhan)

Modified:
    hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
    hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/events/AddPartitionEvent.java
    hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/events/DropPartitionEvent.java
    hive/branches/branch-0.9/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreEventListener.java

Modified: hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java?rev=1412750&r1=1412749&r2=1412750&view=diff
==============================================================================
--- hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
(original)
+++ hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
Fri Nov 23 04:50:22 2012
@@ -1195,6 +1195,7 @@ public class HiveMetaStore extends Thrif
         throws InvalidObjectException, AlreadyExistsException, MetaException {
       boolean success = false, madeDir = false;
       Path partLocation = null;
+      Table tbl = null;
       try {
         try {
           for(MetaStorePreEventListener listener : preListeners){
@@ -1217,7 +1218,7 @@ public class HiveMetaStore extends Thrif
         if (old_part != null) {
           throw new AlreadyExistsException("Partition already exists:" + part);
         }
-        Table tbl = ms.getTable(part.getDbName(), part.getTableName());
+        tbl = ms.getTable(part.getDbName(), part.getTableName());
         if (tbl == null) {
           throw new InvalidObjectException(
               "Unable to add partition because table or database do not exist");
@@ -1294,7 +1295,7 @@ public class HiveMetaStore extends Thrif
           }
         }
         for (MetaStoreEventListener listener : listeners) {
-          listener.onAddPartition(new AddPartitionEvent(part, success, this));
+          listener.onAddPartition(new AddPartitionEvent(tbl, part, success, this));
         }
       }
       Map<Partition, Boolean> returnVal = new HashMap<Partition, Boolean>();
@@ -1402,7 +1403,7 @@ public class HiveMetaStore extends Thrif
           }
         }
         for (MetaStoreEventListener listener : listeners) {
-          listener.onDropPartition(new DropPartitionEvent(part, success, this));
+          listener.onDropPartition(new DropPartitionEvent(tbl, part, success, this));
         }
       }
       return true;

Modified: hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/events/AddPartitionEvent.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/events/AddPartitionEvent.java?rev=1412750&r1=1412749&r2=1412750&view=diff
==============================================================================
--- hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/events/AddPartitionEvent.java
(original)
+++ hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/events/AddPartitionEvent.java
Fri Nov 23 04:50:22 2012
@@ -20,14 +20,17 @@ package org.apache.hadoop.hive.metastore
 
 import org.apache.hadoop.hive.metastore.HiveMetaStore.HMSHandler;
 import org.apache.hadoop.hive.metastore.api.Partition;
+import org.apache.hadoop.hive.metastore.api.Table;
 
 public class AddPartitionEvent extends ListenerEvent {
 
+  private final Table table;
   private final Partition partition;
 
-  public AddPartitionEvent (Partition partition, boolean status, HMSHandler handler) {
+  public AddPartitionEvent (Table table, Partition partition, boolean status, HMSHandler
handler) {
 
     super (status, handler);
+    this.table = table;
     this.partition = partition;
   }
 
@@ -37,4 +40,11 @@ public class AddPartitionEvent extends L
   public Partition getPartition() {
     return partition;
   }
+
+  /**
+   * @return the table
+   */
+  public Table getTable() {
+    return table;
+  }
 }
\ No newline at end of file

Modified: hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/events/DropPartitionEvent.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/events/DropPartitionEvent.java?rev=1412750&r1=1412749&r2=1412750&view=diff
==============================================================================
--- hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/events/DropPartitionEvent.java
(original)
+++ hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/events/DropPartitionEvent.java
Fri Nov 23 04:50:22 2012
@@ -20,14 +20,17 @@ package org.apache.hadoop.hive.metastore
 
 import org.apache.hadoop.hive.metastore.HiveMetaStore.HMSHandler;
 import org.apache.hadoop.hive.metastore.api.Partition;
+import org.apache.hadoop.hive.metastore.api.Table;
 
 public class DropPartitionEvent extends ListenerEvent {
 
+  private final Table table;
   private final Partition partition;
 
-  public DropPartitionEvent (Partition partition, boolean status, HMSHandler handler) {
+  public DropPartitionEvent (Table table, Partition partition, boolean status, HMSHandler
handler) {
 
     super (status, handler);
+    this.table = table;
     this.partition = partition;
   }
 
@@ -38,4 +41,11 @@ public class DropPartitionEvent extends 
 
     return partition;
   }
+
+  /**
+   * @return the table
+   */
+  public Table getTable() {
+    return table;
+  }
 }

Modified: hive/branches/branch-0.9/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreEventListener.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.9/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreEventListener.java?rev=1412750&r1=1412749&r2=1412750&view=diff
==============================================================================
--- hive/branches/branch-0.9/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreEventListener.java
(original)
+++ hive/branches/branch-0.9/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreEventListener.java
Fri Nov 23 04:50:22 2012
@@ -125,6 +125,10 @@ public class TestMetaStoreEventListener 
     assertEquals(expectedPartition, actualPartition);
   }
 
+  private void validateTableInAddPartition(Table expectedTable, Table actualTable) {
+    assertEquals(expectedTable, actualTable);
+  }
+
   private void validatePartition(Partition expectedPartition, Partition actualPartition)
{
     assertEquals(expectedPartition.getValues(), actualPartition.getValues());
     assertEquals(expectedPartition.getDbName(), actualPartition.getDbName());
@@ -167,6 +171,10 @@ public class TestMetaStoreEventListener 
     validatePartition(expectedPartition, actualPartition);
   }
 
+  private void validateTableInDropPartition(Table expectedTable, Table actualTable) {
+    validateTable(expectedTable, actualTable);
+  }
+
   private void validateDropTable(Table expectedTable, Table actualTable) {
     validateTable(expectedTable, actualTable);
   }
@@ -222,6 +230,7 @@ public class TestMetaStoreEventListener 
     AddPartitionEvent partEvent = (AddPartitionEvent)(notifyList.get(listSize-1));
     assert partEvent.getStatus();
     validateAddPartition(part, partEvent.getPartition());
+    validateTableInAddPartition(tbl, partEvent.getTable());
 
     PreAddPartitionEvent prePartEvent = (PreAddPartitionEvent)(preNotifyList.get(listSize-1));
     validateAddPartition(part, prePartEvent.getPartition());
@@ -308,6 +317,7 @@ public class TestMetaStoreEventListener 
     DropPartitionEvent dropPart = (DropPartitionEvent)notifyList.get(listSize - 1);
     assert dropPart.getStatus();
     validateDropPartition(part, dropPart.getPartition());
+    validateTableInDropPartition(tbl, dropPart.getTable());
 
     PreDropPartitionEvent preDropPart = (PreDropPartitionEvent)preNotifyList.get(listSize
- 1);
     validateDropPartition(part, preDropPart.getPartition());



Mime
View raw message