jackye1995 commented on a change in pull request #2354:
URL: https://github.com/apache/iceberg/pull/2354#discussion_r605992816
##########
File path: core/src/test/java/org/apache/iceberg/TestTableMetadata.java
##########
@@ -646,6 +659,55 @@ public void testUpdateSortOrder() {
NullOrder.NULLS_FIRST,
sortedByX.sortOrder().fields().get(0).nullOrder());
}
+ @Test
+ public void testRowKey() {
+ Schema schema = new Schema(
+ Types.NestedField.required(10, "x", Types.StringType.get())
+ );
+
+ TableMetadata meta = TableMetadata.newTableMetadata(
+ schema, PartitionSpec.unpartitioned(), null, ImmutableMap.of());
+ RowKey rowKey = meta.rowKey();
+ Assert.assertTrue("Row key must be default", rowKey.isNotIdentified());
+ }
+
+ @Test
+ public void testUpdateRowKey() {
+ Schema schema = new Schema(
+ Types.NestedField.required(10, "x", Types.StringType.get()),
+ Types.NestedField.required(11, "y", Types.StringType.get())
+ );
+
+ RowKey id = RowKey.builderFor(schema).addField("x").build();
+
+ TableMetadata identifiedByX = TableMetadata.newTableMetadata(
+ schema, PartitionSpec.unpartitioned(), SortOrder.unsorted(), id, null,
ImmutableMap.of());
+ RowKey actualKey = identifiedByX.rowKey();
+ Assert.assertEquals("Row key must have 1 field", 1,
actualKey.identifierFields().size());
+ Assert.assertEquals("Row key must have the expected field",
+ org.apache.commons.compress.utils.Sets.newHashSet(1),
Review comment:
oh yeah, Intellij keeps giving me this, I fixed a few and missed this
one, thanks
--
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]