[ https://issues.apache.org/jira/browse/HIVE-25234?focusedWorklogId=611283&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-611283 ]
ASF GitHub Bot logged work on HIVE-25234: ----------------------------------------- Author: ASF GitHub Bot Created on: 15/Jun/21 12:18 Start Date: 15/Jun/21 12:18 Worklog Time Spent: 10m Work Description: lcspinter commented on a change in pull request #2382: URL: https://github.com/apache/hive/pull/2382#discussion_r651732394 ########## File path: iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerNoScan.java ########## @@ -155,6 +155,58 @@ public void after() throws Exception { HiveIcebergStorageHandlerTestUtils.close(shell); } + @Test + public void testSetPartitionTransform() { + Schema schema = new Schema( + optional(1, "id", Types.LongType.get()), + optional(2, "year_field", Types.DateType.get()), + optional(3, "month_field", Types.TimestampType.withZone()), + optional(4, "day_field", Types.TimestampType.withoutZone()), + optional(5, "hour_field", Types.TimestampType.withoutZone()), + optional(6, "truncate_field", Types.StringType.get()), + optional(7, "bucket_field", Types.StringType.get()), + optional(8, "identity_field", Types.StringType.get()) + ); + + TableIdentifier identifier = TableIdentifier.of("default", "part_test"); + shell.executeStatement("CREATE EXTERNAL TABLE " + identifier + + " PARTITIONED BY SPEC (year(year_field), hour(hour_field), " + + "truncate(2, truncate_field), bucket(2, bucket_field), identity_field)" + + " STORED BY ICEBERG " + + testTables.locationForCreateTableSQL(identifier) + + "TBLPROPERTIES ('" + InputFormatConfig.TABLE_SCHEMA + "'='" + + SchemaParser.toJson(schema) + "', " + + "'" + InputFormatConfig.CATALOG_NAME + "'='" + Catalogs.ICEBERG_DEFAULT_CATALOG_NAME + "')"); + + PartitionSpec spec = PartitionSpec.builderFor(schema) + .year("year_field") + .hour("hour_field") + .truncate("truncate_field", 2) + .bucket("bucket_field", 2) + .identity("identity_field") + .build(); + + Table table = testTables.loadTable(identifier); + Assert.assertEquals(spec, table.spec()); + + shell.executeStatement("ALTER TABLE default.part_test SET PARTITION SPEC(year(year_field), month(month_field), " + + "day(day_field))"); + + spec = PartitionSpec.builderFor(schema) + .withSpecId(1) + .year("year_field") + .alwaysNull("hour_field", "hour_field_hour") + .alwaysNull("truncate_field", "truncate_field_trunc") + .alwaysNull("bucket_field", "bucket_field_bucket") + .alwaysNull("identity_field", "identity_field") + .month("month_field") + .day("day_field") + .build(); + + table.refresh(); + Assert.assertEquals(spec, table.spec()); + } + Review comment: I added an additional test case to cover the partition evolution. Thanks for the idea! -- 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 Issue Time Tracking ------------------- Worklog Id: (was: 611283) Time Spent: 1h 10m (was: 1h) > Implement ALTER TABLE ... SET PARTITION SPEC to change partitioning on > Iceberg tables > ------------------------------------------------------------------------------------- > > Key: HIVE-25234 > URL: https://issues.apache.org/jira/browse/HIVE-25234 > Project: Hive > Issue Type: Improvement > Reporter: László Pintér > Assignee: László Pintér > Priority: Major > Labels: pull-request-available > Time Spent: 1h 10m > Remaining Estimate: 0h > > Provide a way to change the schema and the Iceberg partitioning specification > using Hive syntax. > {code:sql} > ALTER TABLE tbl SET PARTITION SPEC(...) > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)