rdblue commented on a change in pull request #2465:
URL: https://github.com/apache/iceberg/pull/2465#discussion_r615319518
##########
File path: core/src/test/java/org/apache/iceberg/TestSchemaUpdate.java
##########
@@ -1223,4 +1223,98 @@ public void testMoveBetweenStructsFails() {
.moveBefore("s2.x", "s1.a")
.apply());
}
+
+ @Test
+ public void testAddIdentifierField() {
+ Schema newSchema = new SchemaUpdate(SCHEMA, SCHEMA_LAST_COLUMN_ID)
+ .allowIncompatibleChanges()
+ .addIdentifierField("id")
+ .addRequiredColumn("id2", Types.StringType.get())
+ .addIdentifierField("id2")
+ .apply();
+ Assert.assertEquals(Sets.newHashSet(1, SCHEMA_LAST_COLUMN_ID + 1),
newSchema.identifierFieldIds());
+
+ AssertHelpers.assertThrows("Should fail if column with name not exist",
+ IllegalArgumentException.class,
+ "Cannot find column of the given name in existing or newly added
columns",
Review comment:
What is the given name? I think this error message should be "Cannot
find column in existing or new columns: unknown"
--
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]