HIVE-17459 : View deletion operation failed to replicate on target cluster (Tao 
Li, reviewed by Thejas Nair)


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

Branch: refs/heads/hive-14535
Commit: 307a7cda3c36c603643888235dba24ceac164a61
Parents: 3354742
Author: Thejas M Nair <the...@hortonworks.com>
Authored: Mon Sep 11 12:04:10 2017 -0700
Committer: Thejas M Nair <the...@hortonworks.com>
Committed: Mon Sep 11 12:04:32 2017 -0700

----------------------------------------------------------------------
 .../hive/ql/parse/TestReplicationScenarios.java      | 15 +++++++++++++++
 .../java/org/apache/hadoop/hive/ql/exec/DDLTask.java |  2 +-
 .../apache/hadoop/hive/ql/plan/DropTableDesc.java    |  7 +++++++
 3 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/307a7cda/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
----------------------------------------------------------------------
diff --git 
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
 
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
index 5eae1fe..aae5a7c 100644
--- 
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
+++ 
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
@@ -2029,6 +2029,21 @@ public class TestReplicationScenarios {
     printOutput(driverMirror);
     run("REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + "'", 
driverMirror);
     verifyRun("SHOW COLUMNS FROM " + dbName + "_dupe.virtual_view_rename", new 
String[] {"a", "a_"}, driverMirror);
+
+    // Test "DROP VIEW"
+    run("DROP VIEW " + dbName + ".virtual_view", driver);
+    verifyIfTableNotExist(dbName, "virtual_view", metaStoreClient);
+
+    // Perform REPL-DUMP/LOAD
+    advanceDumpDir();
+    run("REPL DUMP " + dbName + " FROM " + incrementalDumpId, driver);
+    incrementalDumpLocn = getResult(0, 0, driver);
+    incrementalDumpId = getResult(0, 1, true, driver);
+    LOG.info("Incremental-dump: Dumped to {} with id {}", incrementalDumpLocn, 
incrementalDumpId);
+    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + 
"'", driverMirror);
+    printOutput(driverMirror);
+    run("REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + "'", 
driverMirror);
+    verifyIfTableNotExist(dbName + "_dupe", "virtual_view", 
metaStoreClientMirror);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/hive/blob/307a7cda/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 bb73d28..8aa2d90 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) {
+    if (tbl != null && dropTbl.getExpectedType() != null) {
       if (tbl.isView()) {
         if (!dropTbl.getExpectView()) {
           if (dropTbl.getIfExists()) {

http://git-wip-us.apache.org/repos/asf/hive/blob/307a7cda/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 74c742c..b99f5bc 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
@@ -117,6 +117,13 @@ 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() {

Reply via email to