You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ek...@apache.org on 2018/06/16 03:52:23 UTC

hive git commit: HIVE-19917: Export of full CRUD transactional table fails if table is not in default database (Eugene Koifman, reviewed by Jason Dere)

Repository: hive
Updated Branches:
  refs/heads/branch-3 2b4868746 -> fb1e5ba7a


HIVE-19917: Export of full CRUD transactional table fails if table is not in default database (Eugene Koifman, reviewed by Jason Dere)


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

Branch: refs/heads/branch-3
Commit: fb1e5ba7ae381ba8e10cd004e8a7297269217672
Parents: 2b48687
Author: Eugene Koifman <ek...@apache.org>
Authored: Fri Jun 15 20:48:13 2018 -0700
Committer: Eugene Koifman <ek...@apache.org>
Committed: Fri Jun 15 20:48:13 2018 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/ql/TestTxnExIm.java  | 23 +++++++++++++++-----
 1 file changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/fb1e5ba7/ql/src/test/org/apache/hadoop/hive/ql/TestTxnExIm.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/TestTxnExIm.java b/ql/src/test/org/apache/hadoop/hive/ql/TestTxnExIm.java
index 8d3ab77..ad4ed76 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/TestTxnExIm.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/TestTxnExIm.java
@@ -53,18 +53,29 @@ public class TestTxnExIm extends TxnCommandsBaseForTests {
    * simplest export test.
    */
   @Test
-  public void testExport() throws Exception {
+  public void testExportDefaultDb() throws Exception {
+    testExport(true);
+  }
+  @Test
+  public void testExportCustomDb() throws Exception {
+    testExport(false);
+  }
+  private void testExport(boolean useDefualtDb) throws Exception {
     int[][] rows1 = {{1, 2}, {3, 4}};
-    runStatementOnDriver("drop table if exists T");
+    final String tblName = useDefualtDb ? "T" : "foo.T";
+    runStatementOnDriver("drop table if exists " + tblName);
     runStatementOnDriver("drop table if exists TImport ");
-    runStatementOnDriver("create table T (a int, b int) stored as ORC");
+    if(!useDefualtDb) {
+      runStatementOnDriver("create database foo");
+    }
+    runStatementOnDriver("create table " + tblName + " (a int, b int) stored as ORC");
     runStatementOnDriver("create table TImport (a int, b int) stored as ORC TBLPROPERTIES " +
         "('transactional'='false')");
-    runStatementOnDriver("insert into T(a,b) " + makeValuesClause(rows1));
-    List<String> rs = runStatementOnDriver("select * from T order by a,b");
+    runStatementOnDriver("insert into " + tblName + "(a,b) " + makeValuesClause(rows1));
+    List<String> rs = runStatementOnDriver("select * from " + tblName + " order by a,b");
     Assert.assertEquals("Content didn't match rs", stringifyValues(rows1), rs);
 
-    String exportStmt = "export table T to '" + getTestDataDir() + "/export'";
+    String exportStmt = "export table " + tblName + " to '" + getTestDataDir() + "/export'";
     rs = runStatementOnDriver("explain " + exportStmt);
     StringBuilder sb = new StringBuilder("*** " + exportStmt);
     for (String r : rs) {