You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by da...@apache.org on 2017/07/13 18:17:21 UTC

hive git commit: HIVE-17021: Support replication of concatenate operation (Sankar Hariappan, reviewed by Daniel Dai)

Repository: hive
Updated Branches:
  refs/heads/master 31a7987fd -> 65b351bc3


HIVE-17021: Support replication of concatenate operation (Sankar Hariappan, reviewed by Daniel Dai)


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

Branch: refs/heads/master
Commit: 65b351bc380b0a4cbc6cdb207f623bac562012b7
Parents: 31a7987
Author: Daniel Dai <da...@hortonworks.com>
Authored: Thu Jul 13 11:17:08 2017 -0700
Committer: Daniel Dai <da...@hortonworks.com>
Committed: Thu Jul 13 11:17:08 2017 -0700

----------------------------------------------------------------------
 .../hive/ql/parse/TestReplicationScenarios.java | 53 ++++++++++++++++++++
 1 file changed, 53 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/65b351bc/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 fa68896..6250ad6 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
@@ -2412,6 +2412,59 @@ public class TestReplicationScenarios {
   }
 
   @Test
+  public void testConcatenateTable() throws IOException {
+    String testName = "concatenateTable";
+    String dbName = createDB(testName);
+
+    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS ORC");
+
+    String[] unptn_data = new String[] { "eleven", "twelve" };
+    String[] empty = new String[] {};
+    run("INSERT INTO TABLE " + dbName + ".unptned values('" + unptn_data[0] + "')");
+
+    // Bootstrap dump/load
+    String replDbName = dbName + "_dupe";
+    Tuple bootstrapDump = bootstrapLoadAndVerify(dbName, replDbName);
+
+    run("INSERT INTO TABLE " + dbName + ".unptned values('" + unptn_data[1] + "')");
+    run("ALTER TABLE " + dbName + ".unptned CONCATENATE");
+
+    // Replicate all the events happened after bootstrap
+    Tuple incrDump = incrementalLoadAndVerify(dbName, bootstrapDump.lastReplId, replDbName);
+    verifyRun("SELECT a from " + replDbName + ".unptned ORDER BY a", unptn_data);
+  }
+
+  @Test
+  public void testConcatenatePartitionedTable() throws IOException {
+    String testName = "concatenatePartitionedTable";
+    String dbName = createDB(testName);
+
+    run("CREATE TABLE " + dbName + ".ptned(a string) PARTITIONED BY (b int) STORED AS ORC");
+
+    String[] ptn_data_1 = new String[] { "fifteen", "fourteen", "thirteen" };
+    String[] ptn_data_2 = new String[] { "fifteen", "seventeen", "sixteen" };
+
+    run("INSERT INTO TABLE " + dbName + ".ptned PARTITION(b=1) values('" + ptn_data_1[0] + "')");
+    run("INSERT INTO TABLE " + dbName + ".ptned PARTITION(b=2) values('" + ptn_data_2[0] + "')");
+
+    // Bootstrap dump/load
+    String replDbName = dbName + "_dupe";
+    Tuple bootstrapDump = bootstrapLoadAndVerify(dbName, replDbName);
+
+    run("INSERT INTO TABLE " + dbName + ".ptned PARTITION(b=1) values('" + ptn_data_1[1] + "')");
+    run("INSERT INTO TABLE " + dbName + ".ptned PARTITION(b=1) values('" + ptn_data_1[2] + "')");
+    run("INSERT INTO TABLE " + dbName + ".ptned PARTITION(b=2) values('" + ptn_data_2[1] + "')");
+    run("INSERT INTO TABLE " + dbName + ".ptned PARTITION(b=2) values('" + ptn_data_2[2] + "')");
+
+    run("ALTER TABLE " + dbName + ".ptned PARTITION(b=2) CONCATENATE");
+
+    // Replicate all the events happened so far
+    Tuple incrDump = incrementalLoadAndVerify(dbName, bootstrapDump.lastReplId, replDbName);
+    verifySetup("SELECT a from " + replDbName + ".ptned where (b=1) ORDER BY a", ptn_data_1);
+    verifySetup("SELECT a from " + replDbName + ".ptned where (b=2) ORDER BY a", ptn_data_2);
+  }
+
+  @Test
   public void testStatus() throws IOException {
     // first test ReplStateMap functionality
     Map<String,Long> cmap = new ReplStateMap<String,Long>();