ebogi commented on a change in pull request #80: SQOOP-3438 Sqoop Import with 
create hcatalog table for ORC will not w…
URL: https://github.com/apache/sqoop/pull/80#discussion_r282973840
 
 

 ##########
 File path: src/test/org/apache/sqoop/hcat/HCatalogImportTest.java
 ##########
 @@ -770,6 +771,80 @@ 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<String> addlArgsArray = new ArrayList<String>();
+    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 testExternalTableDropAndCreation() throws Exception {
 
 Review comment:
   This test case currently tests only that --drop-and-create-hcatalog-table 
and --hcatalog-external-tabl can present together. For testing the 
drop-if-exist behavior there could be two test cases added: pre-create an 
external table (e.g. via importing one) and try to import it 
   1. with --drop-and-create-hcatalog-table --> should succeed
   2. without --drop-and-create-hcatalog-table --> should throw an exception

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to