vihangk1 commented on a change in pull request #1537: URL: https://github.com/apache/hive/pull/1537#discussion_r499890809
########## File path: standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestObjectStore.java ########## @@ -931,6 +924,64 @@ public void testNotificationOps() throws InterruptedException, MetaException { Assert.assertEquals(0, eventResponse.getEventsSize()); } + /** + * Verify that table type is set correctly based on input table properties. + * Two things are verified: + * <ol> + * <li>When <em>EXTERNAL</em> property is set to <em>true</em>, table type should be external</li> + * <li>When table type is set to external it should remain external</em> + * </ol> + * @throws Exception + */ + @Test + public void testExternalTable() throws Exception { + Database db1 = new DatabaseBuilder() + .setName(DB1) + .setDescription("description") + .setLocation("locationurl") + .build(conf); + objectStore.createDatabase(db1); + + List<Table> tables = new ArrayList<>(4); + Map<String, Boolean> expectedValues = new HashMap<>(); + + int i = 1; + // Case 1: EXTERNAL = true, tableType == MANAGED_TABLE + // The result should be external table + Table tbl1 = buildTable(conf, db1, "t" + i++, true, null); + tables.add(tbl1); + expectedValues.put(tbl1.getTableName(), true); + // Case 2: EXTERNAL = false, tableType == EXTERNAL_TABLE + // The result should be external table + Table tbl2 = buildTable(conf, db1, "t" + i++, false, TableType.EXTERNAL_TABLE.name()); + tables.add(tbl2); + expectedValues.put(tbl2.getTableName(), true); + // Case 3: EXTERNAL = false, tableType == EXTERNAL_TABLE Review comment: the comment should state EXTERNAL = true ########## File path: standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestObjectStore.java ########## @@ -84,15 +85,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Random; -import java.util.Set; -import java.util.UUID; +import java.util.*; Review comment: this change can be reverted since we don't use wildcard imports. ---------------------------------------------------------------- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org