hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject svn commit: r1471220 - in /hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore: HiveMetaStore.java events/DropPartitionEvent.java events/DropTableEvent.java events/PreDropPartitionEvent.java events/PreDropTableEvent.java
Date Wed, 24 Apr 2013 01:09:01 GMT
Author: namit
Date: Wed Apr 24 01:09:01 2013
New Revision: 1471220

URL: http://svn.apache.org/r1471220
Log:
HIVE-4393 Make the deleteData flag accessable from DropTable/Partition events
(Morgan Philips via namit)


Modified:
    hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
    hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/DropPartitionEvent.java
    hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/DropTableEvent.java
    hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/PreDropPartitionEvent.java
    hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/PreDropTableEvent.java

Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java?rev=1471220&r1=1471219&r2=1471220&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java Wed
Apr 24 01:09:01 2013
@@ -1150,7 +1150,7 @@ public class HiveMetaStore extends Thrif
           throw new MetaException("Table metadata is corrupted");
         }
 
-        firePreEvent(new PreDropTableEvent(tbl, this));
+        firePreEvent(new PreDropTableEvent(tbl, deleteData, this));
 
         isIndexTable = isIndexTable(tbl);
         if (isIndexTable) {
@@ -1200,7 +1200,7 @@ public class HiveMetaStore extends Thrif
           // ok even if the data is not deleted
         }
         for (MetaStoreEventListener listener : listeners) {
-          DropTableEvent dropTableEvent = new DropTableEvent(tbl, success, this);
+          DropTableEvent dropTableEvent = new DropTableEvent(tbl, success, deleteData, this);
           dropTableEvent.setEnvironmentContext(envContext);
           listener.onDropTable(dropTableEvent);
         }
@@ -1878,7 +1878,7 @@ public class HiveMetaStore extends Thrif
         ms.openTransaction();
         part = ms.getPartition(db_name, tbl_name, part_vals);
         tbl = get_table(db_name, tbl_name);
-        firePreEvent(new PreDropPartitionEvent(tbl, part, this));
+        firePreEvent(new PreDropPartitionEvent(tbl, part, deleteData, this));
 
         if (part == null) {
           throw new NoSuchObjectException("Partition doesn't exist. "
@@ -1924,7 +1924,8 @@ public class HiveMetaStore extends Thrif
           }
         }
         for (MetaStoreEventListener listener : listeners) {
-          DropPartitionEvent dropPartitionEvent = new DropPartitionEvent(tbl, part, success,
this);
+          DropPartitionEvent dropPartitionEvent =
+            new DropPartitionEvent(tbl, part, success, deleteData, this);
           dropPartitionEvent.setEnvironmentContext(envContext);
           listener.onDropPartition(dropPartitionEvent);
         }

Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/DropPartitionEvent.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/DropPartitionEvent.java?rev=1471220&r1=1471219&r2=1471220&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/DropPartitionEvent.java
(original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/DropPartitionEvent.java
Wed Apr 24 01:09:01 2013
@@ -26,11 +26,16 @@ public class DropPartitionEvent extends 
 
   private final Table table;
   private final Partition partition;
+  private final boolean deleteData;
 
-  public DropPartitionEvent (Table table, Partition partition, boolean status, HMSHandler
handler) {
+  public DropPartitionEvent (Table table,
+      Partition partition, boolean status, boolean deleteData, HMSHandler handler) {
     super (status, handler);
     this.table = table;
     this.partition = partition;
+    // In HiveMetaStore, the deleteData flag indicates whether DFS data should be
+    // removed on a drop.
+    this.deleteData = deleteData;
   }
 
   /**
@@ -48,4 +53,12 @@ public class DropPartitionEvent extends 
 
     return table;
   }
+
+  /**
+   * @return the deleteData flag
+   */
+  public boolean getDeleteData() {
+
+    return deleteData;
+  }
 }

Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/DropTableEvent.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/DropTableEvent.java?rev=1471220&r1=1471219&r2=1471220&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/DropTableEvent.java
(original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/DropTableEvent.java
Wed Apr 24 01:09:01 2013
@@ -24,10 +24,14 @@ import org.apache.hadoop.hive.metastore.
 public class DropTableEvent extends ListenerEvent {
 
   private final Table table;
+  private final boolean deleteData;
 
-  public DropTableEvent(Table table, boolean status, HMSHandler handler) {
+  public DropTableEvent(Table table, boolean status, boolean deleteData, HMSHandler handler)
{
     super(status, handler);
     this.table = table;
+    // In HiveMetaStore, the deleteData flag indicates whether DFS data should be
+    // removed on a drop.
+    this.deleteData = false;
   }
 
   /**
@@ -36,4 +40,11 @@ public class DropTableEvent extends List
   public Table getTable() {
     return table;
   }
+
+  /**
+   * @return the deleteData flag
+   */
+  public boolean getDeleteData() {
+    return deleteData;
+  }
 }

Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/PreDropPartitionEvent.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/PreDropPartitionEvent.java?rev=1471220&r1=1471219&r2=1471220&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/PreDropPartitionEvent.java
(original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/PreDropPartitionEvent.java
Wed Apr 24 01:09:01 2013
@@ -26,18 +26,23 @@ public class PreDropPartitionEvent exten
 
   private final Partition partition;
   private final Table table;
+  private final boolean deleteData;
 
-  public PreDropPartitionEvent (Partition partition, HMSHandler handler) {
+  public PreDropPartitionEvent (Partition partition, boolean deleteData, HMSHandler handler)
{
     super (PreEventType.DROP_PARTITION, handler);
     this.partition = partition;
     this.table = null;
+    // In HiveMetaStore, the deleteData flag indicates whether DFS data should be
+    // removed on a drop.
+    this.deleteData = false;
   }
 
-
-  public PreDropPartitionEvent (Table table, Partition partition, HMSHandler handler) {
+  public PreDropPartitionEvent (Table table,
+      Partition partition, boolean deleteData, HMSHandler handler) {
     super (PreEventType.DROP_PARTITION, handler);
     this.partition = partition;
     this.table = table;
+    this.deleteData = false;
   }
 
   /**
@@ -54,4 +59,12 @@ public class PreDropPartitionEvent exten
   public Table getTable() {
     return table;
   }
+
+  /**
+   * @return the deleteData flag
+   */
+  public boolean getDeleteData() {
+
+    return deleteData;
+  }
 }

Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/PreDropTableEvent.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/PreDropTableEvent.java?rev=1471220&r1=1471219&r2=1471220&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/PreDropTableEvent.java
(original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/PreDropTableEvent.java
Wed Apr 24 01:09:01 2013
@@ -24,10 +24,14 @@ import org.apache.hadoop.hive.metastore.
 public class PreDropTableEvent extends PreEventContext {
 
   private final Table table;
+  private final boolean deleteData;
 
-  public PreDropTableEvent(Table table, HMSHandler handler) {
+  public PreDropTableEvent(Table table, boolean deleteData, HMSHandler handler) {
     super(PreEventType.DROP_TABLE, handler);
     this.table = table;
+    // In HiveMetaStore, the deleteData flag indicates whether DFS data should be
+    // removed on a drop.
+    this.deleteData = false;
   }
 
   /**
@@ -37,4 +41,11 @@ public class PreDropTableEvent extends P
     return table;
   }
 
+  /**
+   * @return the deleteData flag
+   */
+  public boolean getDeleteData() {
+    return deleteData;
+  }
+
 }



Mime
View raw message