emkornfield commented on code in PR #14266:
URL: https://github.com/apache/iceberg/pull/14266#discussion_r2421787351


##########
core/src/test/java/org/apache/iceberg/TestSchemaUpdate.java:
##########
@@ -2503,4 +2520,47 @@ public void testAddRequiredUnknown() {
         .isInstanceOf(IllegalArgumentException.class)
         .hasMessage("Cannot create required field with unknown type: unk");
   }
+
+  @Test
+  public void testDateToTimestampPromotionNotAllowedInV2() {
+    Schema schema = new Schema(required(1, "col", Types.DateType.get()));
+    // v2 format does not allow date to timestamp promotion
+    assertThatThrownBy(
+            () ->
+                new SchemaUpdate(schema, 1, 2)
+                    .updateColumn("col", Types.TimestampType.withoutZone()))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Cannot change column type: col: date -> timestamp");
+  }
+
+  @Test
+  public void testDateToTimestampTzPromotionNotAllowedInV3() {
+    Schema schema = new Schema(required(1, "col", Types.DateType.get()));
+    // v3 format does not allow date to timestamptz promotion
+    assertThatThrownBy(
+            () ->
+                new SchemaUpdate(schema, 1, 3).updateColumn("col", 
Types.TimestampType.withZone()))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Cannot change column type: col: date -> timestamptz");
+  }
+
+  @Test
+  public void testUpdatePartitionedDateToTimestampV3Fails() {
+    Schema schema =
+        new Schema(
+            required(1, "id", Types.IntegerType.get()), required(2, "ts", 
Types.DateType.get()));
+
+    PartitionSpec spec = PartitionSpec.builderFor(schema).day("ts").build();

Review Comment:
   Shouldn't this pass, day(date) should be equal to day(timestamp)?  
   
   I think this should fail for bucket.  Reference in spec: 
https://iceberg.apache.org/spec/#schema-evolution



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