[ https://issues.apache.org/jira/browse/HIVE-25325?focusedWorklogId=622920&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-622920 ]
ASF GitHub Bot logged work on HIVE-25325: ----------------------------------------- Author: ASF GitHub Bot Created on: 15/Jul/21 09:06 Start Date: 15/Jul/21 09:06 Worklog Time Spent: 10m Work Description: 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 622920) Time Spent: 20m (was: 10m) > Add TRUNCATE TABLE support for Hive Iceberg tables > -------------------------------------------------- > > Key: HIVE-25325 > URL: https://issues.apache.org/jira/browse/HIVE-25325 > Project: Hive > Issue Type: Improvement > Reporter: Marta Kuczora > Assignee: Marta Kuczora > Priority: Major > Labels: pull-request-available > Fix For: 4.0.0 > > Time Spent: 20m > Remaining Estimate: 0h > > Implement the TRUNCATE operation for Hive Iceberg tables. Since these tables > are unpartitioned in Hive, only the truncate unpartitioned table use case has > to be supported. -- This message was sent by Atlassian Jira (v8.3.4#803005)