pvary commented on a change in pull request #1495:
URL: https://github.com/apache/iceberg/pull/1495#discussion_r498235121
##########
File path:
mr/src/test/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandlerBaseTest.java
##########
@@ -157,6 +177,282 @@ public void testJoinTables() throws IOException {
Assert.assertArrayEquals(new Object[] {1L, "Bob", 102L, 33.33d},
rows.get(2));
}
+ @Test
+ public void testCreateDropTable() throws TException, IOException {
+ // We need the location for HadoopTable based tests only
+ String location = locationForCreateTable(temp.getRoot().getPath(),
"customers");
+ shell.executeStatement("CREATE EXTERNAL TABLE customers " +
+ "STORED BY 'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler' " +
+ (location != null ? "LOCATION '" + location + "' " : "") +
+ "TBLPROPERTIES ('" + InputFormatConfig.TABLE_SCHEMA + "'='" +
SchemaParser.toJson(CUSTOMER_SCHEMA) + "', " +
+ "'" + InputFormatConfig.PARTITION_SPEC + "'='" +
PartitionSpecParser.toJson(IDENTITY_SPEC) + "', " +
+ "'dummy'='test')");
+
+ Properties properties = new Properties();
+ properties.put(Catalogs.NAME, TableIdentifier.of("default",
"customers").toString());
+ if (location != null) {
+ properties.put(Catalogs.LOCATION, location);
+ }
+
+ // Check the Iceberg table data
+ org.apache.iceberg.Table icebergTable =
Catalogs.loadTable(shell.getHiveConf(), properties);
+ Assert.assertEquals(SchemaParser.toJson(CUSTOMER_SCHEMA),
SchemaParser.toJson(icebergTable.schema()));
+ Assert.assertEquals(PartitionSpecParser.toJson(IDENTITY_SPEC),
PartitionSpecParser.toJson(icebergTable.spec()));
Review comment:
Done
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]