jackye1995 commented on a change in pull request #2465:
URL: https://github.com/apache/iceberg/pull/2465#discussion_r616304204
##########
File path: core/src/test/java/org/apache/iceberg/TestTableMetadata.java
##########
@@ -646,6 +646,34 @@ public void testUpdateSortOrder() {
NullOrder.NULLS_FIRST,
sortedByX.sortOrder().fields().get(0).nullOrder());
}
+ @Test
+ public void testParseSchemaIdentifierFields() throws Exception {
+ String data = readTableMetadataInputFile("TableMetadataV2Valid.json");
+ TableMetadata parsed = TableMetadataParser.fromJson(
+ ops.io(), null, JsonUtil.mapper().readValue(data, JsonNode.class));
+ Assert.assertEquals(Sets.newHashSet(),
parsed.schemasById().get(0).identifierFieldIds());
+ Assert.assertEquals(Sets.newHashSet(1, 2),
parsed.schemasById().get(1).identifierFieldIds());
+ }
+
+ @Test
+ public void testUpdateSchemaIdentifierFields() {
+ Schema schema = new Schema(
+ Types.NestedField.required(10, "x", Types.StringType.get())
+ );
+
+ TableMetadata meta = TableMetadata.newTableMetadata(
+ schema, PartitionSpec.unpartitioned(), null, ImmutableMap.of());
+ Assert.assertTrue("Should default to no identifier field",
meta.schema().identifierFieldIds().isEmpty());
Review comment:
Yes you are correct, this is not validating TableMetadata behavior. Let
me just remove it.
--
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]