Repository: hive
Updated Branches:
  refs/heads/master 057d4df54 -> 266c50554


HIVE-17570 : Fix view deletion related test failures (create_view.q etc) (Tao 
Li via Thejas Nair)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/266c5055
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/266c5055
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/266c5055

Branch: refs/heads/master
Commit: 266c50554b86462d8b5ac84d28a2b237b8dbfa7e
Parents: 057d4df
Author: Tao LI <[email protected]>
Authored: Thu Sep 21 17:34:37 2017 -0700
Committer: Thejas M Nair <[email protected]>
Committed: Thu Sep 21 17:34:37 2017 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/ql/exec/DDLTask.java |  2 +-
 .../repl/load/message/DropTableHandler.java     |  2 +-
 .../hadoop/hive/ql/plan/DropTableDesc.java      | 28 +++++++++++++++-----
 3 files changed, 23 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/266c5055/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
index 714ea1f..ad5b3a3 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
@@ -4198,7 +4198,7 @@ public class DDLTask extends Task<DDLWork> implements 
Serializable {
 
   private void dropTable(Hive db, Table tbl, DropTableDesc dropTbl) throws 
HiveException {
     // This is a true DROP TABLE
-    if (tbl != null && dropTbl.getExpectedType() != null) {
+    if (tbl != null && dropTbl.getValidationRequired()) {
       if (tbl.isView()) {
         if (!dropTbl.getExpectView()) {
           if (dropTbl.getIfExists()) {

http://git-wip-us.apache.org/repos/asf/hive/blob/266c5055/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/load/message/DropTableHandler.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/load/message/DropTableHandler.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/load/message/DropTableHandler.java
index d2f5248..4d400f4 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/load/message/DropTableHandler.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/load/message/DropTableHandler.java
@@ -37,7 +37,7 @@ public class DropTableHandler extends AbstractMessageHandler {
     String actualTblName = context.isTableNameEmpty() ? msg.getTable() : 
context.tableName;
     DropTableDesc dropTableDesc = new DropTableDesc(
         actualDbName + "." + actualTblName,
-        null, true, true, context.eventOnlyReplicationSpec()
+        null, true, true, context.eventOnlyReplicationSpec(), false
     );
     Task<DDLWork> dropTableTask = TaskFactory.get(
         new DDLWork(readEntitySet, writeEntitySet, dropTableDesc),

http://git-wip-us.apache.org/repos/asf/hive/blob/266c5055/ql/src/java/org/apache/hadoop/hive/ql/plan/DropTableDesc.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/DropTableDesc.java 
b/ql/src/java/org/apache/hadoop/hive/ql/plan/DropTableDesc.java
index b99f5bc..27d1ec8 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/plan/DropTableDesc.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/DropTableDesc.java
@@ -58,6 +58,7 @@ public class DropTableDesc extends DDLDesc implements 
Serializable {
   boolean ifExists;
   boolean ifPurge;
   ReplicationSpec replicationSpec;
+  boolean validationRequired;
   
 
   public DropTableDesc() {
@@ -70,16 +71,28 @@ public class DropTableDesc extends DDLDesc implements 
Serializable {
   public DropTableDesc(
       String tableName, TableType expectedType, boolean ifExists,
       boolean ifPurge, ReplicationSpec replicationSpec) {
+         this(tableName, expectedType, ifExists, ifPurge, replicationSpec, 
true);
+  }
+
+  public DropTableDesc(
+      String tableName, TableType expectedType, boolean ifExists,
+      boolean ifPurge, ReplicationSpec replicationSpec, boolean 
validationRequired) {
     this.tableName = tableName;
     this.partSpecs = null;
     this.expectedType = expectedType;
     this.ifExists = ifExists;
     this.ifPurge = ifPurge;
     this.replicationSpec = replicationSpec;
+    this.validationRequired = validationRequired;
   }
 
   public DropTableDesc(String tableName, Map<Integer, 
List<ExprNodeGenericFuncDesc>> partSpecs,
       TableType expectedType, boolean ifPurge, ReplicationSpec 
replicationSpec) {
+    this(tableName, partSpecs, expectedType, ifPurge, replicationSpec, true);
+  }
+
+  public DropTableDesc(String tableName, Map<Integer, 
List<ExprNodeGenericFuncDesc>> partSpecs,
+      TableType expectedType, boolean ifPurge, ReplicationSpec 
replicationSpec,  boolean validationRequired) {
     this.tableName = tableName;
     this.partSpecs = new ArrayList<PartSpec>(partSpecs.size());
     for (Map.Entry<Integer, List<ExprNodeGenericFuncDesc>> partSpec : 
partSpecs.entrySet()) {
@@ -91,6 +104,7 @@ public class DropTableDesc extends DDLDesc implements 
Serializable {
     this.expectedType = expectedType;
     this.ifPurge = ifPurge;
     this.replicationSpec = replicationSpec;
+    this.validationRequired = validationRequired;
   }
 
   /**
@@ -117,13 +131,6 @@ public class DropTableDesc extends DDLDesc implements 
Serializable {
   }
 
   /**
-   * @return the expectedType
-   */
-  public TableType getExpectedType() {
-    return expectedType;
-  }
-
-  /**
    * @return whether to expect a view being dropped
    */
   public boolean getExpectView() {
@@ -177,4 +184,11 @@ public class DropTableDesc extends DDLDesc implements 
Serializable {
     }
     return this.replicationSpec;
   }
+
+  /**
+   * @return whether the table type validation is needed (false in repl case)
+   */
+  public boolean getValidationRequired(){
+    return this.validationRequired;
+  }
 }

Reply via email to