pvary commented on a change in pull request #2471:
URL: https://github.com/apache/hive/pull/2471#discussion_r670278116
##########
File path:
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerWithEngine.java
##########
@@ -1313,6 +1313,186 @@ public void testScanTableCaseInsensitive() throws
IOException {
Assert.assertArrayEquals(new Object[] {1L, "Bob", "Green"}, rows.get(1));
}
+ @Test
+ public void testTruncateTable() throws IOException, TException,
InterruptedException {
+ // Create an Iceberg table with some records in it then execute a truncate
table command.
+ // Then check if the data is deleted and the table statistics are reset to
0.
+ String databaseName = "default";
+ String tableName = "customers";
+ Table icebergTable = testTables.createTable(shell, tableName,
HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA,
+ fileFormat, HiveIcebergStorageHandlerTestUtils.CUSTOMER_RECORDS);
+ testTruncateTable(databaseName, tableName, icebergTable,
HiveIcebergStorageHandlerTestUtils.CUSTOMER_RECORDS,
+ HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA, true, false);
+ }
+
+ @Test
+ public void testTruncateEmptyTable() throws IOException, TException,
InterruptedException {
+ // Create an empty Iceberg table and execute a truncate table command on
it.
+ String databaseName = "default";
+ String tableName = "customers";
+ String fullTableName = databaseName + "." + tableName;
Review comment:
nit: I usually use:
```
TableIdentifier identifier = TableIdentifier.of(databaseName, tableName);
[...]
String alterTableCommand =
"ALTER TABLE " + identifier + " SET
TBLPROPERTIES('external.table.purge'='true')";
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]