marton-bod commented on a change in pull request #2191:
URL: https://github.com/apache/iceberg/pull/2191#discussion_r570169564
##########
File path:
mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerNoScan.java
##########
@@ -568,6 +571,53 @@ public void testIcebergAndHmsTableProperties() throws
TException, InterruptedExc
}
}
+ @Test
+ public void testDropTableWithAppendedData() throws IOException {
+ TableIdentifier identifier = TableIdentifier.of("default", "customers");
+
+ shell.executeStatement(String.format("CREATE EXTERNAL TABLE %s STORED BY
'%s' %s" +
+ "TBLPROPERTIES ('%s'='%s', '%s'='%s')",
+ identifier,
+ HiveIcebergStorageHandler.class.getName(),
+ testTables.locationForCreateTableSQL(identifier),
+ InputFormatConfig.TABLE_SCHEMA,
SchemaParser.toJson(HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA),
+ InputFormatConfig.PARTITION_SPEC, PartitionSpecParser.toJson(SPEC)));
+
+ org.apache.iceberg.Table icebergTable = testTables.loadTable(identifier);
+ testTables.appendIcebergTable(shell.getHiveConf(), icebergTable,
FileFormat.PARQUET, null, CUSTOMER_RECORDS);
+
+ shell.executeStatement("DROP TABLE customers");
+ }
+
+ @Test
+ public void testDropHiveTableWithoutUnderlyingTable() throws IOException {
+ TableIdentifier identifier = TableIdentifier.of("default", "customers");
+
+ if (!Catalogs.hiveCatalog(shell.getHiveConf())) {
+ // Create the Iceberg table in non-HiveCatalog
+ testTables.createIcebergTable(shell.getHiveConf(), identifier.name(),
CUSTOMER_SCHEMA, FileFormat.PARQUET,
+ CUSTOMER_RECORDS);
+
+ // Create Hive table on top
+ String tableLocation = testTables.locationForCreateTableSQL(identifier);
Review comment:
We need the `external.table.purge=TRUE` HMS table property to test the
deletion scenario upon dropping the Hive table. However, this property only
gets appended as an HMS table property in the MetaHook when using Hive Catalog,
for non-HiveCatalog tables it doesn't get appended so I was using direct SQL.
I've refactored `TestTables.createHiveTableSQL` to enable adding additional
table properties to the Hive SQL.
----------------------------------------------------------------
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]