clettieri commented on code in PR #8192:
URL: https://github.com/apache/iceberg/pull/8192#discussion_r1324506388


##########
spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestAlterTablePartitionFields.java:
##########
@@ -179,6 +179,82 @@ public void testAddHoursPartition() {
     Assert.assertEquals("Should have new spec field", expected, table.spec());
   }
 
+  @Test
+  public void testAddYearPartition() {
+    sql(
+        "CREATE TABLE %s (id bigint NOT NULL, category string, ts timestamp, 
data string) USING iceberg",
+        tableName);
+    Table table = validationCatalog.loadTable(tableIdent);
+
+    Assert.assertTrue("Table should start unpartitioned", 
table.spec().isUnpartitioned());
+
+    sql("ALTER TABLE %s ADD PARTITION FIELD year(ts)", tableName);
+
+    table.refresh();
+
+    PartitionSpec expected =
+        
PartitionSpec.builderFor(table.schema()).withSpecId(1).year("ts").build();
+
+    Assert.assertEquals("Should have new spec field", expected, table.spec());

Review Comment:
   Will do :)



-- 
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]

Reply via email to