Index: metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreEventListener.java =================================================================== --- metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreEventListener.java (revision 1405924) +++ metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreEventListener.java (working copy) @@ -125,6 +125,10 @@ 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 @@ 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 @@ 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 @@ 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()); Index: metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java =================================================================== --- metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java (revision 1405924) +++ metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java (working copy) @@ -1195,6 +1195,7 @@ 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 @@ 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 @@ } } for (MetaStoreEventListener listener : listeners) { - listener.onAddPartition(new AddPartitionEvent(part, success, this)); + listener.onAddPartition(new AddPartitionEvent(tbl, part, success, this)); } } Map returnVal = new HashMap(); @@ -1402,7 +1403,7 @@ } } for (MetaStoreEventListener listener : listeners) { - listener.onDropPartition(new DropPartitionEvent(part, success, this)); + listener.onDropPartition(new DropPartitionEvent(tbl, part, success, this)); } } return true; Index: metastore/src/java/org/apache/hadoop/hive/metastore/events/DropPartitionEvent.java =================================================================== --- metastore/src/java/org/apache/hadoop/hive/metastore/events/DropPartitionEvent.java (revision 1405924) +++ metastore/src/java/org/apache/hadoop/hive/metastore/events/DropPartitionEvent.java (working copy) @@ -20,14 +20,17 @@ 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 @@ return partition; } + + /** + * @return the table + */ + public Table getTable() { + return table; + } } Index: metastore/src/java/org/apache/hadoop/hive/metastore/events/AddPartitionEvent.java =================================================================== --- metastore/src/java/org/apache/hadoop/hive/metastore/events/AddPartitionEvent.java (revision 1405924) +++ metastore/src/java/org/apache/hadoop/hive/metastore/events/AddPartitionEvent.java (working copy) @@ -20,14 +20,17 @@ 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 Partition getPartition() { return partition; } + + /** + * @return the table + */ + public Table getTable() { + return table; + } } \ No newline at end of file