From ec707d0b38c9920bc878227743e9d957cb7ed62c Mon Sep 17 00:00:00 2001 From: Denes Bodo Date: Thu, 9 May 2019 14:47:08 +0200 Subject: [PATCH] SQOOP-3438 Sqoop Import with create hcatalog table for ORC will not work with Hive3 as the table created would be a ACID table and transactional Adding tests Change-Id: I03eb99c469e030deff84982c724a72f311a0f631 --- .../apache/sqoop/hcat/HCatalogImportTest.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/test/org/apache/sqoop/hcat/HCatalogImportTest.java b/src/test/org/apache/sqoop/hcat/HCatalogImportTest.java index c7e1ea6f..4a38e2d6 100644 --- a/src/test/org/apache/sqoop/hcat/HCatalogImportTest.java +++ b/src/test/org/apache/sqoop/hcat/HCatalogImportTest.java @@ -770,6 +770,29 @@ public void testTableCreation() throws Exception { null, true, false); } + @Test + public void testExternalTableCreation() throws Exception { + final int TOTAL_RECORDS = 1 * 10; + String table = getTableName().toUpperCase(); + ColumnGenerator[] cols = new ColumnGenerator[] { + HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0), + "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0, + new HiveVarchar("1", 20), "1", KeyType.STATIC_KEY), + HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1), + "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0, + new HiveVarchar("2", 20), "2", KeyType.DYNAMIC_KEY), + }; + List addlArgsArray = new ArrayList(); + addlArgsArray.add("--create-hcatalog-table"); + addlArgsArray.add("--hcatalog-external-table"); + addlArgsArray.add("--hcatalog-storage-stanza"); + addlArgsArray.add("\"stored as orc tblproperties (\"transactional\"=\"false\")\""); + setExtraArgs(addlArgsArray); + utils.dropHCatTableIfExists(table, SqoopHCatUtilities.DEFHCATDB); + runHCatImport(addlArgsArray, TOTAL_RECORDS, table, cols, + null, true, false); + } + @Test public void testTableCreationWithPartition() throws Exception { final int TOTAL_RECORDS = 1 * 10;